Part Number Hot Search : 
20KW160 APE8842 MAX385 1HTFXXX MDS105AL C1602 IRF63 1620C
Product Description
Full Text Search
 

To Download MC68HC11PH8 Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  h c 1 1 MC68HC11PH8/d MC68HC11PH8 mc68hc7 1 1 ph8 technical d a t a !mo t orola MC68HC11PH8 !mot orola technical data

1 2 3 4 5 6 7 8 9 10 11 a b c introduction pin descriptions operating modes and on-chip memory parallel input/output serial communications interface motorola interconnect bus (mi bus) serial peripheral interface timing system analog-to-digital converter resets and interrupts cpu core and instruction set electrical specifications (standard) mechanical data and ordering information development support tpg 1
1 2 3 4 5 6 7 8 9 10 11 a b c introduction pin descriptions operating modes and on-chip memory parallel input/output serial communications interface motorola interconnect bus (mi bus) serial peripheral interface timing system analog-to-digital converter resets and interrupts cpu core and instruction set electrical specifications (standard) mechanical data and ordering information development support tpg 2
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 all products are sold on motorola? terms & conditions of supply. in ordering a product covered by this document the customer agrees to be bound by those terms & conditions and nothing contained in this document constitutes or forms part of a contract (with the exception of the contents of this notice). a copy of motorola? terms & conditions of supply is availab le on request. motorola reserves the right to make changes without further notice to any products herein. motorola makes no warranty, representation or guarantee regarding the suitability of its products for any particular purpose, nor does motorola assume any liability arising out of the application or use of any product or circuit, and specifically disclaims any and all liability, in cluding without limitation consequential or incidental damages. ?ypical?parameters can and do vary in different applications. all operating parameters, including ?ypicals? must be validated for each customer application by customer? technical experts. motorola does not convey any license under its patent rights nor the rights of others. motorola products are not designed, intended, or authorized for use as components in systems intended for surgical implant into the body, or other applications intended to support or sustain life, or for any other application in which the failure of the motorola product could create a situation where personal injury or death may occur. should buyer purchase or use motorola products for any such unintended or unauthorized application, buyer shall indemnify and hold motorola and its officers, employees, subsidiaries, affiliates, and distributors harmless against all claims, costs, damages, and expenses, and reasonable attorney fees arising out of, directly or indirectly, any claim of personal injury or death associated with such unintended or unauthorized use, even if such claim alleges that motorola was negligent regarding the design or manufacture of the part. motorola and ! are registered trademarks of motorola, inc. motorola, inc. is an equal opportunity/affirmative action employer. the customer should ensure that it has the most up to date version of the document by contacting its local motorola office. this document supersedes any earlier documentation relating to the products referred to herein. the information contained in this document is current at the date of publication. it may subsequently be updated, revised or withdrawn. ?motorola ltd., 1997 all trade marks recognized. this document contains information on new products. speci?ations and information herein are subject to change without notice. MC68HC11PH8 mc68hc711ph8 high-density complementary metal oxide semiconductor (hcmos) microcomputer unit tpg 3
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 conventions abbreviations de?itions of any abbreviations used can be found in the glossary. text in italics this document contains information referring to the MC68HC11PH8 and the mc68hc711ph8. all references to the MC68HC11PH8 apply equally to the mc68hc711ph8, unless otherwise noted. references speci? to the mc68hc711ph8 are italicised in the text. register tables because the bits in any one register are not necessarily linked by a common function, the description of a register may appear in several sections referring to different aspects of device operation. a full description of a bit is given only in a section in which it has relevance. elsewhere, it appears shaded in the register diagram and is only brie? described. state on reset x state of bit on reset depends on factors such as operating mode u state of bit on reset is unde?ed tpg 4
customer feedback questionnaire (MC68HC11PH8/d rev 1) motorola wishes to continue to improve the quality of its documentation. we would welcome your feedback on the publication you have just received. having used the document, please complete this card (or a photocopy of it, if you prefer). 1. how would you rate the quality of the document? check one box in each category. excellent poor excellent poor organization tables readability table of contents understandability index accuracy page size/binding illustrations overall impression comments: 2. what is your intended use for this document? if more than one option applies, please rank them (1, 2, 3). selection of device for new application other please specify: system design training purposes 3. how well does this manual enable you to perform the task(s) outlined in question 2? completely not at all comments: 4. how easy is it to ?d the information you are looking for? easy dif?ult comments: 5. is the level of technical detail in the following sections suf?ient to allow you to understand how the device functions? too little detail too much detail comments: 6. have you found any errors? if so, please comment: 7. from your point of view, is anything missing from the document? if so, please say what: ?cut along this line to remove section 1 introduction section 2 pin descriptions section 3 operating modes and on-chip memory section 4 parallel input/output section 5 serial communications interface section 6 motorola interconnect bus (mi bus) section 7 serial peripheral interface section 8 timing system section 9 analog-to-digital converter section 10 resets and interrupts section 11 cpu core and instruction set appendix a electrical specifications (standard) appendix b mechanical data and ordering information appendix c development support tpg 5
13. currently there is some discussion in the semiconductor industry regarding a move towards providing data sheets in electron ic form. if you have any opinion on this subject, please comment. 14. we would be grateful if you would supply the following information (at your discretion), or attach your card. name: phone no: position: fax no: department: company: address: thank you for helping us improve our documentation, graham livey, technical publications manager, motorola ltd., scotland . ?cut along this line to remove ?second fold back along this line ?third fold back along this line ?last tuck this edge into opposite ?p 8. how could we improve this document? 9. how would you rate motorolas documentation? excellent poor ?in general ?against other semiconductor suppliers 10. which semiconductor manufacturer provides the best technical documentation? 11. which company (in any ?ld) provides the best technical documentation? 12. how many years have you worked with microprocessors? less than 1 year 1? years 3? years more than 5 years by air mail par avion ne pas affranchir ibrs number phq-b/207/g ccri numero phq-b/207/g reponse payee grande-bretagne motorola ltd., colvilles road, kelvin industrial estate, east kilbride, g75 8br. great britain. f.a.o. technical publications manager (re: MC68HC11PH8/d rev 1) no stamp required ?first fold back along this line ! motorola ltd. semiconductor products sector tpg 6
MC68HC11PH8 motorola i table of contents paragraph number page number title table of contents 1 introduction 1.1 features.................................................................................................................1-1 1.2 mask options .........................................................................................................1-2 2 pin descriptions 2.1 vdd and vss ........................................................................................................2-2 2.2 reset ...................................................................................................................2-3 2.3 crystal driver and external clock input (xtal, extal)..........................................2-3 2.4 e clock output (e) ..................................................................................................2-5 2.5 phase-locked loop (xfc, vddsyn, 4xout) ........................................................2-6 2.5.1 pll operation...................................................................................................2-7 2.5.2 synchronization of pll with subsystems.........................................................2-8 2.5.3 changing the pll frequency ...........................................................................2-8 2.5.4 pll registers....................................................................................................2-8 2.5.4.1 pllcr ?pll control register ...................................................................2-9 2.5.4.2 synr ?synthesizer program register......................................................2-11 2.6 interrupt request (irq ) ..........................................................................................2-12 2.7 nonmaskable interrupt (xirq / vppe )....................................................................2-12 2.8 moda and modb (moda/lir and modb/vstby) .............................................2-13 2.9 vrh and vrl ........................................................................................................2-13 2.10 pg7/r/w ...............................................................................................................2-13 2.11 port signals ............................................................................................................2-1 4 2.11.1 port a ...............................................................................................................2-14 2.11.2 port b ...............................................................................................................2-14 2.11.3 port c ...............................................................................................................2-16 2.11.4 port d ...............................................................................................................2-16 2.11.5 port e ...............................................................................................................2-17 2.11.6 port f ...............................................................................................................2-17 2.11.7 port g...............................................................................................................2-17 2.11.8 port h ...............................................................................................................2-18 2.12 lcd module...........................................................................................................2-18 2.12.1 lcdr ?lcd control and data register...........................................................2-18 tpg 7
motorola ii MC68HC11PH8 table of contents paragraph number page number title 3 operating modes and on-chip memory 3.1 operating modes ...................................................................................................3-1 3.1.1 single chip operating mode .............................................................................3-1 3.1.2 expanded operating mode...............................................................................3-1 3.1.3 special test -mode ...........................................................................................3-2 3.1.4 special bootstrap mode ...................................................................................3-2 3.2 on-chip memory....................................................................................................3-3 3.2.1 mapping allocations .........................................................................................3-4 3.2.1.1 ram ...........................................................................................................3-4 3.2.1.2 rom and eprom......................................................................................3-5 3.2.1.3 bootloader rom ........................................................................................3-5 3.2.2 registers..........................................................................................................3-5 3.3 system initialization ...............................................................................................3-10 3.3.1 mode selection.................................................................................................3-10 3.3.1.1 hprio ?highest priority i-bit interrupt & misc. register ...........................3-11 3.3.2 initialization ......................................................................................................3-12 3.3.2.1 config ?system con?uration register .................................................3-12 3.3.2.2 init ?ram and i/o mapping register ......................................................3-14 3.3.2.3 init2 ?eeprom mapping and mi bus delay register............................3-16 3.3.2.4 option ?system con?uration options register 1..................................3-17 3.3.2.5 opt2 ?system con?uration options register 2 ......................................3-18 3.3.2.6 bprot ?block protect register................................................................3-21 3.3.2.7 tmsk2 ?timer interrupt mask register 2.................................................3-22 3.4 eprom , eeprom and config register .............................................................3-23 3.4.1 eprom ............................................................................................................3-23 3.4.1.1 eprog ?eprom programming control register .....................................3-23 3.4.1.2 eprom programming ................................................................................3-24 3.4.2 eeprom .........................................................................................................3-25 3.4.2.1 pprog ?eeprom programming control register ..................................3-25 3.4.2.2 eeprom bulk erase ..................................................................................3-27 3.4.2.3 eeprom row erase ...................................................................................3-28 3.4.2.4 eeprom byte erase ..................................................................................3-28 3.4.3 config register programming........................................................................3-29 3.4.4 ram and eeprom security............................................................................3-30 4 parallel input/output 4.1 port a.....................................................................................................................4 -2 4.1.1 porta ?port a data register ........................................................................4-2 4.1.2 ddra ?data direction register for port a .....................................................4-2 tpg 8
MC68HC11PH8 motorola iii table of contents paragraph number page number title 4.2 port b.....................................................................................................................4 -3 4.2.1 portb ?port b data register ........................................................................4-3 4.2.2 ddrb ?data direction register for port b ......................................................4-3 4.3 port c.....................................................................................................................4 -4 4.3.1 portc ?port c data register........................................................................4-4 4.3.2 ddrc ?data direction register for port c......................................................4-4 4.4 port d.....................................................................................................................4 -5 4.4.1 portd ?port d data register........................................................................4-5 4.4.2 ddrd ?data direction register for port d......................................................4-5 4.5 port e.....................................................................................................................4 -6 4.5.1 porte ?port e data register ........................................................................4-6 4.6 port f .....................................................................................................................4 -7 4.6.1 portf ?port f data register.........................................................................4-7 4.6.2 ddrf ?data direction register for port f.......................................................4-7 4.7 port g ....................................................................................................................4- 8 4.7.1 portg ?port g data register .......................................................................4-8 4.7.2 ddrg ?data direction register for port g .....................................................4-8 4.8 port h.....................................................................................................................4 -9 4.8.1 porth ?port h data register........................................................................4-9 4.8.2 ddrh ?data direction register for port h......................................................4-9 4.8.3 wired-or interrupt...........................................................................................4-10 4.8.3.1 woieh ?woi enable (woieh) ...............................................................4-10 4.9 internal pull-up resistors ........................................................................................4-11 4.9.1 ppar ?port pull-up assignment register .......................................................4-11 4.10 system con?uration .............................................................................................4-11 4.10.1 opt2 ?system con?uration options register 2 ............................................4-12 4.10.2 config ?system con?uration register .......................................................4-13 5 serial communications interface 5.1 data format ............................................................................................................5-2 5.2 transmit operation .................................................................................................5-2 5.3 receive operation..................................................................................................5-2 5.4 wake-up feature ....................................................................................................5-4 5.4.1 idle-line wake-up ..............................................................................................5-4 5.4.2 address-mark wake-up ....................................................................................5-4 5.5 sci error detection ................................................................................................5-5 5.6 sci registers ..........................................................................................................5-5 5.6.1 scbdh, scbdl ?sci baud rate control registers ........................................5-6 5.6.2 sccr1 ?sci control register 1 .....................................................................5-7 5.6.3 sccr2 ?sci control register 2 .....................................................................5-9 5.6.4 scsr1 ?sci status register 1.......................................................................5-10 5.6.5 scsr2 ?sci status register 2.......................................................................5-12 5.6.6 scdrh, scdrl ?sci data high/low registers .............................................5-12 tpg 9
motorola iv MC68HC11PH8 table of contents paragraph number page number title 5.7 status ?gs and interrupts.....................................................................................5-13 5.7.1 receiver ?gs ..................................................................................................5-13 5.8 sci2 ......................................................................................................................5- 15 5.8.1 s2bdh, s2bdl ?sci2 baud rate control registers .......................................5-15 5.8.2 s2cr1 ?sci2 control register 1....................................................................5-16 5.8.3 s2cr2 ?sci2 control register 2....................................................................5-16 5.8.4 s2sr1 ?sci2 status register 1 .....................................................................5-16 5.8.5 s2sr2 ?sci2 status register 2 .....................................................................5-17 5.8.6 s2drh, s2drl ?sci2 data high/low registers ............................................5-17 6 motorola interconnect bus (mi bus) 6.1 push-pull sequence ...............................................................................................6-2 6.1.1 the push ?ld ..................................................................................................6-2 6.1.2 the pull ?ld ....................................................................................................6-3 6.2 biphase coding ......................................................................................................6-3 6.3 message validation................................................................................................6-4 6.3.1 controller detected errors ................................................................................6-4 6.3.2 mcu detected errors .......................................................................................6-4 6.4 interfacing to mi bus ............................................................................................6-6 6.5 mi bus clock rate..................................................................................................6-7 6.6 sci2/mi bus registers ..........................................................................................6-7 6.6.1 init2 ?eeprom mapping and mi bus delay register .................................6-8 6.6.2 s2bdh, s2bdl ?mi bus clock rate control registers...................................6-9 6.6.3 s2cr1 ?mi bus control register 1 ...............................................................6-9 6.6.4 s2cr2 ?mi bus control register 2 ...............................................................6-10 6.6.5 s2sr1 ?mi bus status register 1 .................................................................6-11 6.6.6 s2sr2 ?mi bus2 status register 2 ...............................................................6-12 6.6.7 s2drl ?mi bus2 data register ....................................................................6-12 7 serial peripheral interface 7.1 functional description ...........................................................................................7-1 7.2 spi transfer formats...............................................................................................7-2 7.2.1 clock phase and polarity controls....................................................................7-3 7.3 spi signals ............................................................................................................7-3 7.3.1 master in slave out...........................................................................................7-4 7.3.2 master out slave in...........................................................................................7-4 7.3.3 serial clock ......................................................................................................7-4 7.3.4 slave select......................................................................................................7-4 7.4 spi system errors ..................................................................................................7-5 tpg 10
MC68HC11PH8 motorola v table of contents paragraph number page number title 7.5 spi registers ..........................................................................................................7-5 7.5.1 spcr ?spi control register...........................................................................7-6 7.5.2 spsr ?spi status register ............................................................................7-7 7.5.3 spdr ?spi data register...............................................................................7-8 7.5.4 opt2 ?system con?uration options register 2 ............................................7-9 7.6 spi2 .......................................................................................................................7 -10 7.6.1 sp2cr ?spi2 control register.......................................................................7-11 7.6.2 sp2sr ?spi2 status register ........................................................................7-11 7.6.3 sp2dr ?spi2 data register...........................................................................7-11 7.6.4 sp2opt ?spi2 control options register ........................................................7-11 8 timing system 8.1 16-bit timer.............................................................................................................8-1 8.1.1 timer enable control ........................................................................................8-3 8.1.1.1 pllcr ?pll control register ...................................................................8-3 8.1.2 timer structure.................................................................................................8-4 8.1.3 input capture ....................................................................................................8-8 8.1.3.1 tctl2 ?timer control register 2 ..............................................................8-9 8.1.3.2 tic1?ic3 ?timer input capture registers...............................................8-10 8.1.3.3 ti4/o5 ?timer input capture 4/output compare 5 register .......................8-10 8.1.4 output compare ...............................................................................................8-11 8.1.4.1 toc1?oc4 ?timer output compare registers .......................................8-12 8.1.4.2 cforc ?timer compare force register ...................................................8-12 8.1.4.3 oc1m ?output compare 1 mask register ................................................8-13 8.1.4.4 oc1d ?output compare 1 data register ..................................................8-13 8.1.4.5 tcnt ?timer counter register .................................................................8-14 8.1.4.6 tctl1 ?timer control register 1 ..............................................................8-14 8.1.4.7 tmsk1 ?timer interrupt mask register 1 .................................................8-15 8.1.4.8 tflg1 ?timer interrupt ?g register 1 ....................................................8-16 8.1.4.9 tmsk2 ?timer interrupt mask register 2 .................................................8-17 8.1.4.10 tflg2 ?timer interrupt ?g register 2 ....................................................8-18 8.1.5 real-time interrupt ...........................................................................................8-19 8.1.5.1 tmsk2 ?timer interrupt mask register 2 .................................................8-20 8.1.5.2 tflg2 ?timer interrupt ?g register 2 ....................................................8-21 8.1.5.3 pactl ?pulse accumulator control register ............................................8-22 8.1.6 computer operating properly watchdog function .............................................8-23 8.1.7 lcd module .....................................................................................................8-23 8.1.8 pulse accumulator ...........................................................................................8-23 8.1.8.1 pactl ?pulse accumulator control register ............................................8-25 8.1.8.2 pacnt ?pulse accumulator count register..............................................8-26 8.1.8.3 pulse accumulator status and interrupt bits ...............................................8-26 8.1.8.4 tmsk2 ?timer interrupt mask 2 register .................................................8-26 8.1.8.5 tflg2 ?timer interrupt ?g 2 register ....................................................8-26 tpg 11
motorola vi MC68HC11PH8 table of contents paragraph number page number title 8.2 pulse-width modulation (pwm) timer ....................................................................8-27 8.2.1 pwm timer block diagram................................................................................8-28 8.2.2 pwclk ?pwm clock prescaler and 16-bit select register ............................8-28 8.2.2.1 16-bit pwm function...................................................................................8-28 8.2.2.2 clock prescaler selection ...........................................................................8-30 8.2.3 pwpol ?pwm timer polarity & clock source select register ........................8-31 8.2.4 pwscal ?pwm timer prescaler register .....................................................8-31 8.2.5 pwen ?pwm timer enable register ..............................................................8-32 8.2.6 pwcnt1? ?pwm timer counter registers 1 to 4 ........................................8-33 8.2.7 pwper1? ?pwm timer period registers 1 to 4 ..........................................8-33 8.2.8 pwdty1? ?pwm timer duty cycle registers 1 to 4.....................................8-34 8.2.9 boundary cases ...............................................................................................8-34 8.3 8-bit modulus timers ..............................................................................................8-35 8.3.1 modulus timer operation ..................................................................................8-35 8.3.2 clock rate selection..........................................................................................8-37 8.3.2.1 t8adr ?8-bit modulus timer a data register...........................................8-38 8.3.2.2 t8acr ?8-bit modulus timer a control register .......................................8-38 8.3.2.3 t8bdr ?8-bit modulus timer b data register...........................................8-39 8.3.2.4 t8bcr ?8-bit modulus timer b control register .......................................8-39 8.3.2.5 t8cdr ?8-bit modulus timer c data register ..........................................8-40 8.3.2.6 t8ccr ?8-bit modulus timer c control register.......................................8-40 9 analog-to-digital converter 9.1 overview................................................................................................................9-1 9.1.1 multiplexer........................................................................................................9-2 9.1.2 analog converter..............................................................................................9-3 9.1.3 digital control ...................................................................................................9-3 9.1.4 result registers................................................................................................9-4 9.1.5 a/d converter clocks ........................................................................................9-4 9.1.6 conversion sequence ......................................................................................9-4 9.1.7 conversion process .........................................................................................9-5 9.2 a/d converter power-up and clock select ..............................................................9-5 9.2.1 option ?system con?uration options register 1 .......................................9-5 9.3 channel assignments ............................................................................................9-7 9.3.1 single-channel operation .................................................................................9-7 9.3.2 multiple-channel operation...............................................................................9-8 9.4 control, status and results registers ......................................................................9-8 9.4.1 adctl ?a/d control and status register .......................................................9-8 9.4.2 adr1?dr4 ?a/d converter results registers..............................................9-10 9.5 operation in stop and wait modes....................................................................9-10 tpg 12
MC68HC11PH8 motorola vii table of contents paragraph number page number title 10 resets and interrupts 10.1 resets .................................................................................................................10-1 10.1.1 power-on reset ...............................................................................................10-1 10.1.2 external reset (reset ) .................................................................................10-2 10.1.3 cop reset ......................................................................................................10-2 10.1.3.1 coprst ?arm/reset cop timer circuitry register.................................10-3 10.1.4 clock monitor reset ........................................................................................10-4 10.1.5 option ?system con?uration options register 1 .....................................10-4 10.1.6 config ?con?uration control register ....................................................10-6 10.2 effects of reset.....................................................................................................10-7 10.2.1 central processing unit ..................................................................................10-8 10.2.2 memory map ..................................................................................................10-8 10.2.3 parallel i/o .....................................................................................................10-8 10.2.4 timer..............................................................................................................10-8 10.2.5 real-time interrupt (rti) ................................................................................10-9 10.2.6 pulse accumulator .........................................................................................10-9 10.2.7 computer operating properly (cop) ..............................................................10-9 10.2.8 8-bit modulus timer system ............................................................................10-9 10.2.9 serial communications interface (sci)...........................................................10-9 10.2.10 serial peripheral interface (spi) .....................................................................10-10 10.2.11 analog-to-digital converter .............................................................................10-10 10.2.12 lcd module ...................................................................................................10-10 10.2.13 system ...........................................................................................................10-10 10.3 reset and interrupt priority ..................................................................................10-11 10.3.1 hprio ?highest priority i-bit interrupt and misc. register ...........................10-12 10.4 interrupts .............................................................................................................10-1 5 10.4.1 interrupt recognition and register stacking.....................................................10-15 10.4.2 nonmaskable interrupt request (xirq )..........................................................10-16 10.4.3 illegal opcode trap..........................................................................................10-16 10.4.4 software interrupt...........................................................................................10-16 10.4.5 maskable interrupts........................................................................................10-17 10.4.6 reset and interrupt processing ......................................................................10-17 10.5 low power operation ...........................................................................................10-17 10.5.1 wait ..............................................................................................................10-17 10.5.2 stop .............................................................................................................10-18 11 cpu core and instruction set 11.1 registers .............................................................................................................11-1 11.1.1 accumulators a, b and d...............................................................................11-2 11.1.2 index register x (ix) .......................................................................................11-2 11.1.3 index register y (iy) .......................................................................................11-2 tpg 13
motorola viii MC68HC11PH8 table of contents paragraph number page number title 11.1.4 stack pointer (sp)..........................................................................................11-2 11.1.5 program counter (pc)....................................................................................11-4 11.1.6 condition code register (ccr).......................................................................11-4 11.1.6.1 carry/borrow (c) ......................................................................................11-5 11.1.6.2 over?w (v) .............................................................................................11-5 11.1.6.3 zero (z) ....................................................................................................11-5 11.1.6.4 negative (n) .............................................................................................11-5 11.1.6.5 interrupt mask (i)......................................................................................11-5 11.1.6.6 half carry (h)............................................................................................11-6 11.1.6.7 x interrupt mask (x) .................................................................................11-6 11.1.6.8 stop disable (s)........................................................................................11-6 11.2 data types ...........................................................................................................11-6 11.3 opcodes and operands .......................................................................................11-7 11.4 addressing modes...............................................................................................11-7 11.4.1 immediate (imm)............................................................................................11-7 11.4.2 direct (dir)....................................................................................................11-7 11.4.3 extended (ext) .............................................................................................11-8 11.4.4 indexed (ind, x; ind, y).................................................................................11-8 11.4.5 inherent (inh) ................................................................................................11-8 11.4.6 relative (rel)................................................................................................11-8 11.5 instruction set ......................................................................................................11-8 a electrical specifications (standard) a.1 maximum ratings .................................................................................................. a-1 a.2 thermal characteristics and power considerations .............................................. a-2 a.3 test methods ........................................................................................................ a-3 a.4 dc electrical characteristics ................................................................................. a-4 a.4.1 dc electrical characteristics ?modes of operation ....................................... a-5 a.5 control timing ....................................................................................................... a-6 a.5.1 peripheral port timing...................................................................................... a-9 a.5.2 pll control timing ........................................................................................... a-10 a.5.3 analog-to-digital converter characteristics...................................................... a-11 a.5.4 serial peripheral interface timing .................................................................... a-12 a.5.5 non-multiplexed expansion bus timing ........................................................... a-15 a.5.6 eeprom characteristics ................................................................................ a-16 a.5.7 eprom characteristics .................................................................................. a-16 tpg 14
MC68HC11PH8 motorola ix table of contents paragraph number page number title b mechanical data and ordering information b.1 pin assignments ................................................................................................... b-1 b.2 package dimensions............................................................................................. b-3 b.3 ordering information............................................................................................. b-6 c development support c.1 evs ?evaluation system.................................................................................... c-1 c.2 mmds11 ?motorola modular development system ........................................... c-2 c.3 spgmr11 ?serial programmer system............................................................. c-2 glossary index tpg 15
motorola x MC68HC11PH8 table of contents this page intentionally left blank tpg 16
MC68HC11PH8 motorola xi list of figures figure number page number title list of figures 1-1 MC68HC11PH8/ mc68hc711ph8 block diagram ..................................................1-3 2-1 84-pin plcc/ cerquad pinout .............................................................................2-1 2-2 112-pin tqfp pinout ..............................................................................................2-2 2-3 external reset circuitry............................................................................................2-3 2-4 oscillator connections (vddsyn = 0, pll disabled) .............................................2-4 2-5 oscillator connections (vddsyn = 1, pll enabled)..............................................2-5 2-6 pll circuit...............................................................................................................2- 6 2-7 ram stand-by connections.....................................................................................2-13 3-1 MC68HC11PH8/ mc68hc711ph8 memory map ...................................................3-3 3-2 example of expanded mode freez actions..........................................................3-13 3-3 ram and register overlap.......................................................................................3-15 5-1 sci baud rate generator circuit diagram.................................................................5-1 5-2 sci1 block diagram ................................................................................................5-3 5-3 interrupt source resolution within sci.....................................................................5-14 6-1 mi bus timing.........................................................................................................6-2 6-2 biphase coding and error detection........................................................................6-3 6-3 mi bus block diagram ............................................................................................6-5 6-4 a typical interface between the MC68HC11PH8 and the mi bus..........................6-6 7-1 spi block diagram...................................................................................................7-2 7-2 spi transfer format..................................................................................................7-3 8-1 timer clock divider chains (pll enabled ?vddsyn high) ..................................8-5 8-2 timer clock divider chains (pll disabled ?vddsyn low) ...................................8-6 8-3 capture/compare block diagram.............................................................................8-7 8-4 pulse accumulator block diagram...........................................................................8-24 8-5 pwm timer block diagram.......................................................................................8-29 8-6 pwm duty cycle......................................................................................................8-34 8-7 8-bit modulus timer system.....................................................................................8-36 9-1 a/d converter block diagram ..................................................................................9-2 9-2 electrical model of an a/d input pin (in sample mode)...........................................9-3 9-3 a/d conversion sequence.......................................................................................9-4 10-1 processing ?w out of reset (1 of 2) .....................................................................10-19 10-2 processing ?w out of reset (2 of 2) .....................................................................10-20 10-3 interrupt priority resolution (1 of 3) .......................................................................10-21 tpg 17
motorola xii MC68HC11PH8 list of figures figure number page number title 10-4 interrupt priority resolution (2 of 3) ....................................................................... 10-22 10-5 interrupt priority resolution (3 of 3) ....................................................................... 10-23 10-6 interrupt source resolution within the sci subsystem .......................................... 10-24 10-7 interrupt source resolution within the 8-bit modulus timer subsystem.................. 10-25 11-1 programming model ............................................................................................. 11-1 11-2 stacking operations .............................................................................................. 11-3 a-1 test methods ..........................................................................................................a-3 a-2 timer inputs............................................................................................................a-6 a-3 reset timing ...........................................................................................................a-7 a-4 interrupt timing .......................................................................................................a-7 a-5 stop recovery timing ............................................................................................a-8 a-6 wait recovery timing .............................................................................................a-8 a-7 port read timing diagram ........................................................................................a-9 a-8 port write timing diagram........................................................................................a-9 a-9 spi master timing (cpha = 0) ...............................................................................a-13 a-10 spi master timing (cpha = 1) ...............................................................................a-13 a-11 spi slave timing (cpha = 0) ..................................................................................a-14 a-12 spi slave timing (cpha = 1) ..................................................................................a-14 a-13 expansion bus timing .............................................................................................a-16 b-1 84-pin plcc/ cerquad pinout .............................................................................b-1 b-2 112-pin tqfp pinout ..............................................................................................b-2 b-3 84-pin plcc mechanical dimensions ....................................................................b-3 b-4 84-pin cerquad mechanical dimensions ............................................................b-4 b-5 112-pin tqfp mechanical dimensions...................................................................b-5 tpg 18
MC68HC11PH8 motorola xiii list of tables ta b l e number page number title list of tables 2-1 pll mask options ...................................................................................................2-7 2-2 port signal functions ...............................................................................................2-15 3-1 example bootloader baud rates..............................................................................3-3 3-2 register and control bit assignments .....................................................................3-6 3-3 registers with limited write access.........................................................................3-10 3-4 hardware mode select summary............................................................................3-11 3-5 ram and register remapping..................................................................................3-15 3-6 eeprom remapping ..............................................................................................3-16 3-7 eeprom block protect...........................................................................................3-21 3-8 erase mode selection .............................................................................................3-26 4-1 port con?uration ...................................................................................................4-1 5-1 example sci baud rate control values ...................................................................5-7 7-1 spi clock rates........................................................................................................7-7 8-1 timer resolution and capacity.................................................................................8-2 8-2 rti periodic rates (pll disabled) ...........................................................................8-19 8-3 rti periodic rates (pll enabled)............................................................................8-19 8-4 pulse accumulator timing .......................................................................................8-23 8-5 clock a and clock b prescalers ..............................................................................8-30 8-6 modulus timers clock sources ................................................................................8-37 9-1 a/d converter channel assignments.......................................................................9-7 10-1 cop timer rate select (pll disabled) ...................................................................10-3 10-2 cop timer rate select (pll enabled)....................................................................10-3 10-3 reset cause, reset vector and operating mode ....................................................10-7 10-4 highest priority interrupt selection ........................................................................10-13 10-5 interrupt and reset vector assignments ................................................................10-14 10-6 stacking order on entry to interrupts ....................................................................10-15 11-1 reset vector comparison......................................................................................11-4 11-2 instruction set .......................................................................................................11-9 b-1 ordering information.............................................................................................. b-6 c-1 m68hc11 development tools ................................................................................ c-1 tpg 19
motorola xiv MC68HC11PH8 list of tables this page intentionally left blank tpg 20
MC68HC11PH8 motorola 1-1 introduction 1 1 introduction the MC68HC11PH8 8-bit microcontroller is a member of the m68hc11 family of hcmos microcontrollers. in addition to 48k bytes of rom, the MC68HC11PH8 contains 2k bytes of ram and 768 bytes of eeprom. making use of an 84-pin plcc, or 112-pin tqfp package, a non-multiplexed expanded bus is a feature of this device. the timer system has been expanded to include three input captures, four output compares and a software selectable input capture or output compare. there are three 8-bit modulus timers, one of which may be used as a prescaler for the other two. the inclusion of a pll circuit allows power consumption and performance to be adjusted to suit operational requirements. other major features of this device are: 8-channel, 8-bit a/d converter, four pwm timer channels, wired-or capability for keyboard interrupt, four lcd segment drivers and two spi and two enhanced sci subsystems. the MC68HC11PH8 is especially suitable for mobile communications and automotive applications. the mc68hc711ph8 is an eprom version of the MC68HC11PH8, with the user rom replaced by a similar amount of eprom. all references to the MC68HC11PH8 apply equally to the mc68hc711ph8, unless otherwise noted. references speci? to the mc68hc711ph8 are italicised in the text. 1.1 features low power, high performance m68hc11 cpu core 48k bytes of user rom (MC68HC11PH8); 48k bytes of user eprom (mc68hc711ph8) 2k bytes of ram 768 bytes of byte-erasable user eeprom, with on-chip charge pump up to 54 general purpose i/o lines, plus up to 8 input-only lines non-multiplexed address and data buses, permitting direct access to the full 64k address map 16-bit timer with 3/4 input captures and 4/5 output compares; pulse accumulator and cop watchdog timer three 8-bit modulus timers, for generating periodic interrupts tpg 21
motorola 1-2 MC68HC11PH8 introduction 1 power saving pll circuit wired-or interrupt capability for keyboard support, allowing wake-up from stop and wait modes two 8- or 9-bit sci subsystems, one with mi bus ? capability; both nrz type for rs232 compatibility two spi subsystems, with software selectable msb/lsb ?st option 8-channel, 8-bit analog-to-digital (a/d) converter four 8-bit pwm timer channels (may be concatenated to form one or two 16-bit channels) 4-segment lcd driver available in 84-pin plcc or 112-pin tqfp packages (MC68HC11PH8); also 84-pin cerquad package (mc68hc711ph8) 1.2 mask options there are ?e mask options available on the MC68HC11PH8. these options are programmed during manufacture and must be speci?d on the order form. security option (available/unavailable); see section 3.4.4 pll oscillator frequency (32khz/614khz); see section 2.5 oscillator buffer type (inverter/schmitt trigger); see section 2.3 por/exit from stop start-up time (4064/128 bus cycles); see section 3.3.2.4 romon bit software switchable in user expanded mode (enable/disable); see section 3.3.2.1 note: these options are not available on the mc68hc711ph8; on this device, the security option is always available, the pll oscillator is optimized for operation at 32 khz, the oscillator buffer is an inverter, the por/exit from stop start-up time is 4064 bus cycles and the romon bit is software switchable in user expanded mode. ? the motorola interconnect bus (mi bus) is a serial communications protocol which supports distributed real-time control ef?iently and with a high degree of noise immunity. it allows data to be transferred between the mcu and the slave device using only one wire, making this type of communication suitable for medium speed networks requiring very low cost multiplex wiring. tpg 22
MC68HC11PH8 motorola 1-3 introduction 1 figure 1-1 MC68HC11PH8/ mc68hc711ph8 block diagram pa 7 pa 6 pa 5 pa 4 pa 2 pa 1 pa 0 pa 3 pd5 pd4 pd3 pd2 pd1 pd0 pe7 pe6 pe5 pe4 pe2 pe1 pe0 pe3 pg7 pg6 pg5 pg4 pg2 pg1 pg0 pg3 ph7 ph6 ph5 ph4 ph2 ph1 ph0 ph3 oc1/pai oc1/oc2 oc1/oc3 oc1/oc4 ic4/oc1/oc5 ic1 ic2 ic3 timer cop watchdog periodic interrupt pulse accumulator port a port d port e port g port h ss 1 sck1 mosi1 miso1 spi1 sci1+ txd1 rxd1 vrh vrl ad7 ad6 ad5 ad4 ad3 ad2 ad1 ad0 8-channel a/d converter 3 x modulus timers pwm pw4 pw3 pw2 pw1 non-multiplexed address and data buses port b port f port c a15 a14 a13 a12 a11 a10 a9 a8 a7 a6 a5 a4 a3 a2 a1 a0 d7 d6 d5 d4 d3 d2 d1 do pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 vppe /xirq irq reset lir /moda vstby/modb interrupts & mode select oscillator xtal extal e xfc vdd vss 5 5 768 bytes eeprom 2048 bytes ram m68hc11 cpu pll vddsyn keyboard woi sci2+ (with mi bus) txd2 rxd2 ss2 sck2 mosi2 miso2 spi2 lcd drivers rom or eprom 49152 x 8 (including 64 bytes for vectors) r/w lcdbp 4xout (see note) note: the 4xout pin is available only on the 112-pin tqfp package. tpg 23
motorola 1-4 MC68HC11PH8 introduction this page intentionally left blank 1 tpg 24
MC68HC11PH8 motorola 2-1 pin descriptions 2 2 pin descriptions the MC68HC11PH8 is available in an 84-pin plastic-leaded chip carrier (plcc) and in an 112-pin thin quad ?t pack (tqfp); in addition to those two packages, the mc68hc711ph8 is also available in an 84-pin windowed cerquad package, to allow the eprom to be erased. most pins on this mcu serve two or more functions, as described in the following paragraphs. refer to figure 2-1 and to figure 2-2 which show the pin assignments for the 84 and 112-pin packages respectively. figure 2-1 84-pin plcc/ cerquad pinout pb0/a8 pb1/a9 pb2/a10 pb3/a11 pb4/a12/lcd4 pb5/a13/lcd5 pb6/a14/lcd6 pb7/a15/lcd7 vss vdd pa0/ic3 pa1/ic2 pa2/ic1 pa3/oc1/oc5/ic4 pa4/oc1/oc4 pa5/oc1/oc3 pa6/oc1/oc2 pa7/oc1/pai pd5/ss pd4/sck pd3/mosi rxd2/pg0 vdd ad ad7/pe7 ad6/pe6 ad5/pe5 ad4/pe4 ad3/pe3 ad2/pe2 ad1/pe1 ad0/pe0 vrl vrh vss ad a7/pf7 a6/pf6 a5/pf5 a4/pf4 a3/pf3 a2/pf2 a1/pf1 a0/pf0 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 11 10 9 8 7 6 5 4 3 2 84 83 82 81 80 79 78 77 76 75 pd2/miso pd1/txd1 pd0/rxd1 moda/lir reset xfc vddsyn extal xtal e vddr vssr pc7/d7 pc6/d6 pc5/d5 pc4/d4 pc3/d3 pc2/d2 pc1/d1 pc0/d0 irq pw1/ph0 pw2/ph1 pw3/ph2 pw4/ph3 ph4 ph5 ph6 ph7 modb/vstby vppe /xirq vdd vddl vssl vss r/w /pg7 lcdbp/pg6 ss2 /pg5 sck2/pg4 mosi2/pg3 miso2/pg2 txd2/pg1 tpg 25
motorola 2-2 MC68HC11PH8 pin descriptions 2 2.1 vdd and vss power is supplied to the microcontroller via these pins. vdd is the positive supply and vss is ground. the mcu operates from a single 5v (nominal) power supply. it is in the nature of cmos designs that very fast signal transitions occur on the mcu pins. these short rise and fall times place very high short-duration current demands on the power supply. to prevent noise problems, special care must be taken to provide good power supply bypassing at the mcu. bypass capacitors should have good high-frequency characteristics and be as close to the mcu as possible. bypassing requirements vary, depending on how heavily the mcu pins are loaded. the MC68HC11PH8 mcu has ?e vdd pins and ?e vss pins. one pair of these pins is reserved for supplying power to the analog-to-digital converter (vdd ad, vss ad); two pairs are used for the internal logic (vdd, vss); the remaining two pairs supply power for the port logic on either half of the chip (vddl, vssl and vddr, vssr). this arrangement minimizes the injection of noise into the digital circuitry on the chip. figure 2-2 112-pin tqfp pinout 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 nc nc pw1/ph0 pw2/ph1 pw3/ph2 pw4/ph3 ph4 ph5 ph6 ph7 nc modb/vstby vppe /xirq nc vddl vssl nc nc r/w /pg7 lcdbp/pg6 ss2 /pg5 sck2/pg4 mosi2/pg3 miso2/pg2 txd2/pg1 nc nc nc rxd2/pg0 nc nc vddad ad7/pe7 ad6/pe6 ad5/pe5 ad4/pe4 ad3/pe3 ad2/pe2 ad1/pe1 ad0/pe0 vrl nc nc vrh vssad nc a7/pf7 a6/pf6 a5/pf5 a4/pf4 a3/pf3 a2/pf2 a1/pf1 a0/pf0 nc nc nc pd2/miso pd1/txd pd0rxd moda/lir reset xfc vddsyn nc nc nc extal xtal e 4xout vddr vssr pc7/d7 pc6/d6 pc5/d5 pc4/d4 pc3/d3 pc2/d2 pc1/d1 pc0/d0 irq nc nc nc nc pb0/a8 pb1/a9 pb2/a10 pb3/a11 pb4/a12/lcd4 pb5/a13/lcd5 pb6/a14/lcd6 pb7/a15/lcd7 vss vdd pa0/ic3 pa3/oc1/oc5/ic4 pa4/oc1/oc4 pa5/oc1/oc3 pa6/oc1/oc2 pa7/oc1/pai pd5/ss pd4/sck pd3/mosi nc nc nc nc nc pa1/ic2 pa2/ic1 tpg 26
MC68HC11PH8 motorola 2-3 pin descriptions 2 2.2 reset an active low bidirectional control signal, reset , acts as an input to initialize the mcu to a known start-up state. it also acts as an open-drain output to indicate that an internal failure has been detected in either the clock monitor or the cop watchdog circuit. the cpu distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than four e clock cycles after an internal reset has been released. it is therefore not advisable to connect an external resistor-capacitor (rc) power-up delay circuit to the reset pin of m68hc11 devices because the circuit charge time constant can cause the device to misinterpret the type of reset that occurred. refer to section 10 for further information. figure 2-3 illustrates a typical reset circuit that includes an external switch together with a low voltage inhibit circuit, to prevent power transitions, or ram or eeprom corruption. 2.3 crystal driver and external clock input (xtal, extal) these two pins provide the interface for either a crystal or a cmos compatible clock to control the internal clock generator circuitry. if the pll circuit is not being used to provide the e clock, the frequency applied to these pins must be four times higher than the desired e clock rate. figure 2-4 shows oscillator connections that should be used when the pll is disabled, and figure 2-5 shows the connections that should be used when the pll is enabled. figure 2-3 external reset circuitry v dd 1 m f v dd 4.7 k w to m68hc11 reset v dd 1 2 3 1 2 3 in reset gnd in reset gnd mc34064 mc34164 manual reset 4.7 k w 4.7 k w tpg 27
motorola 2-4 MC68HC11PH8 pin descriptions 2 the xtal pin is normally left unconnected when an external cmos compatible clock input is connected to the extal pin. however, a 10 k w to 100 k w load resistor connected from xtal to ground can be used to reduce rfi noise emission. the xtal output is normally intended to drive only a crystal. the xtal output can be buffered with a high-impedance buffer, or it can be used to drive the extal input of another m68hc11 family device (unless the pll circuit is in use, in which case the 4xout output must be used to clock a second device; see section 2.5). on the MC68HC11PH8, the type of internal crystal oscillator buffer is determined by a mask option; it can be either an inverter or a schmitt trigger. use of the schmitt trigger type reduces problems caused by noise, in particular with slow clocks. at crystal power-up, the schmitt trigger will only generate internal clocks when the crystal amplitude is suf?ient. however, this type of buffer requires a larger xtal amplitude and is not recommended for use with high frequency crystals, especially if a second mcu is to be driven. this option is not available on the mc68hc711ph8, on which the crystal oscillator buffer is an inverter. in all cases, use caution when designing circuitry associated with the oscillator pins. figure 2-4 oscillator connections (vddsyn = 0, pll disabled) 10 m w 25 pf 4e crystal 25 pf extal xtal m68hc11 note: capacitor values include all stray capacitance. m68hc11 extal xtal nc external oscillator 10 m w 25 pf 4e crystal 25 pf extal xtal m68hc11 m68hc11 extal xtal nc 220 w (a) common crystal connections (b) external oscillator connections (c) one crystal driving two mcus tpg 28
MC68HC11PH8 motorola 2-5 pin descriptions 2 2.4 e clock output (e) e is the output connection for the internally generated e clock. the signal from e is used as a timing reference. the frequency of the e clock output is one quarter that of the input frequency at the xtal and extal pins (except when the pll is used as the clock source). when e clock output is low, an internal process is taking place; when it is high, data is being accessed. all clocks, including the e clock, are halted when the mcu is in stop mode. the e clock output can be turned off to reduce the effects of rfi (see section 3.3.2.5). figure 2-5 oscillator connections (vddsyn = 1, pll enabled) 22 m w 18 pf crystal 20 pf extal xtal m68hc11 note: capacitor values include all stray capacitance. m68hc11 extal xtal nc external oscillator (a) common crystal connections (b) external oscillator 390 k w (32 to 38.4 khz crystal) (a) common crystal connections (500 to 2000 khz crystal) 10 m w 25 pf crystal 25 pf extal xtal m68hc11 note: all values of capacitance and resistance shown are approximate; exact values must be calculated knowing the crystal param eters and the expected voltage and temperature ranges. connections tpg 29
motorola 2-6 MC68HC11PH8 pin descriptions 2 2.5 phase-locked loop (xfc, vddsyn, 4xout) the xfc and vddsyn pins are the inputs for the on-chip pll (phase-locked loop) circuitry. on reset, all system clocks are derived from the internal extal signal (extali). if enabled (vddsyn high), the pll uses the extali frequency as a reference to generate a clock frequency that can be varied under software control. the user may choose to use the pll output instead of extali as the source clock for the system. the pll consists of a variable bandwidth loop ?ter, a voltage controlled oscillator (vco), a feedback frequency divider and a digital phase detector. pll functions are controlled by the pllcr and synr registers. a block diagram of the pll circuit is shown in figure 2-6; refer also to figure 8-1. if enabled by the clk4x bit in the config register, either the 4xclk signal or the extali signal can be output on the 4xout pin, depending on the state of the ext4x bit in the opt2 register. refer to figure 2-6, and to section 3 for a description of the clk4x and ext4x bits. the signal output on the 4xout pin could be used to clock another mcu. note: the 4xout pin is not available on 84-pin packaged devices. figure 2-6 pll circuit bus clock select module clock select frequency divider synr phase detect loop tlter vco f ref pcomp f fb mcs st4xck 4xclk bcs to clock generation circuitry for sci and timer vcoout extali st op extal xtal & xfc vddsyn v ddsyn external connection c xfc key: 0.1 m f 0.01 m f 4xout clock select ext4x 4xout extali tpg 30
MC68HC11PH8 motorola 2-7 pin descriptions 2 2.5.1 pll operation the voltage controlled oscillator (vco) generates the pll output frequency vcoout. this signal is fed back through a frequency divider, which divides the signal frequency by a factor determined by the contents of the synr register, to produce the feedback signal f fb . this signal is input to the phase detector along with the reference signal, f ref . the phase detector generates a control signal (pcomp) which is a function of the phase difference between f fb and f ref . pcomp is then integrated, and the resultant dc voltage (visible on xfc) is applied to the vco, modifying the output signal vcoout to lock it in phase with f ref . note: because the operation of the pll depends on repeated adjustments to the voltage input to the vco, a time t plls is required for the stabilization of the output frequency. the state of two bits in the pllcr register, mcs and bcs, determine whether vcoout or extali is used for the system clocks. a mask option on the MC68HC11PH8 allows the pll circuit to be optimized for operation in either of two frequency ranges, as shown in table 2-1 (this option is not available on the mc68hc711ph8; on this device the pll is optimized for operation at 32khz) . input frequencies other than those included in table 2-1 can be used, but, for operation above the maximum frequency speci?d, vddsyn should be grounded to disable the pll and enable the high frequency oscillator circuit; in this state the oscillator is designed for 16mhz operation and xfc may be left unconnected. refer also to figure 2-5. vddsyn is the power supply pin for the pll and should be suitably bypassed. connecting it high enables the internal low frequency oscillator circuitry designed for the pll. the external capacitor on xfc (c xfc ) should be located as close to the chip as possible to minimize noise. in general, a larger capacitor will improve the plls frequency stability, at the expense of increasing the time required for it to settle (t plls ) at the desired frequency. a capacitor value of 47nf is usually adequate for either 32khz or 614khz applications. refer to section a.5.2 for pll control timing information. the pll ?ter has two bandwidths that can be manually selected under control of the bwc bit in pllcr. whenever the pll is ?st enabled, the wide bandwidth mode should be used, to enable the pll frequency to ramp up quickly. after a time t plls has elapsed, the ?ter can be switched to the narrow bandwidth mode, to make the ?al frequency more stable. warning: bit 5 of the pllcr (auto) must be cleared before an attempt is made to use bwc; manual bandwidth control should always be used. table 2-1 pll mask options characteristic mask option 1 mask option 2 typical input frequency 32 khz 614 khz maximum input frequency 50 khz 2 mhz tpg 31
motorola 2-8 MC68HC11PH8 pin descriptions 2 2.5.2 synchronization of pll with subsystems if the mcs bit in pllcr is set, then the sci and timer clocks run off the pll output (4xclk) as does the cpu. if mcs is cleared, then the timer and sci subsystems operate off the extali frequency, but are accessed by the cpu relative to the internal ph2 signal. in this case, although extali is used as the reference for the pll, the ph2 clock and the module clocks for the timer and the sci are not synchronized. in order to ensure synchronized data, special circuitry has been incorporated into both subsystems. 2.5.3 changing the pll frequency the pll output frequency can be changed by altering the contents of the synr register (see section 2.5.4.2). to prevent possible bursts of high frequency operation during the recon?uration of the pll, the following sequence should be performed: 1) switch to the low frequency bus rate (bcs = 0). 2) disable the pll (pllon = 0). 3) change the value in synr. 4) enable the pll (pllon = 1). 5) wait a time t plls for the pll frequency to stabilize. 6) switch to the high frequency bus rate (bcs = 1). 2.5.4 pll registers two registers are used to control the operation of the MC68HC11PH8 phase locked loop circuitry. these are the pll control register and the synthesizer program register, each of which is described below. tpg 32
MC68HC11PH8 motorola 2-9 pin descriptions 2 2.5.4.1 pllcr ?pll control register this read/write register contains two bits that are used to enable and disable the synthesizer and to switch from slow (extali) to one of the fast speeds. two further bits are used to control the ?ter bandwidth. the sci, timer, timer clock source and the slow clock for wait mode are also controlled by this register. pllon ?pll on 1 (set) switch pll on. 0 (clear) switch pll off. this bit activates the synthesizer circuit without connecting it to the control circuit. this allows the circuit to stabilize before it drives the cpu clocks. on reset, pllon is forced low if the vddsyn supply is low. if vddsyn is at vdd, pllon is set by reset to allow the control loop to stabilize during power-up. pllon cannot be cleared whilst using vcoout to drive the internal processor clock, i.e. when bcs is set. bcs ?bus clock select 1 (set) vcoout output drives the clock circuit (4xclk). 0 (clear) extali drives the clock circuit (4xclk). this bit determines which signal drives the clock circuit generating the bus clocks. once bcs has been altered it can take up to [1.5 extali + 1.5 vcoout] cycles for the change in the clock to occur. reset clears this bit. note: pllon and bcs have built-in safeguards so that vcoout cannot be selected as the clock source (bcs = 1) if the pll is off (pllon = 0). similarly, the pll cannot be turned off (pllon = 0) if it is on and in use (bcs = 1). turning the pll on and selecting vcoout as the clock source therefore requires two independent writes to pllcr. auto ?automatic bandwidth control (test mode only) 1 (set) automatic bandwidth control selected. 0 (clear) manual bandwidth control selected. reset sets this bit. warning: this bit must be cleared before an attempt is made to use bwc; manual bandwidth control should always be used. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pll control (pllcr) $002e pllon bcs auto bwc vcot mcs t16en wen x010 1010 tpg 33
motorola 2-10 MC68HC11PH8 pin descriptions 2 bwc ?bandwidth control 1 (set) wide (high and low) bandwidth control selected. 0 (clear) narrow (low) bandwidth control selected. bandwidth selection can only be controlled by bwc when auto is cleared. after the pll is ?st enabled, or after a change in frequency, a delay of t plls is required before clearing bwc. the low bandwidth driver is always enabled, so this bit determines whether the high bandwidth driver is on or off. reset clears this bit. vcot ?vco test (test mode only) 1 (set) loop ?ter operates as speci?d by auto and bwc. 0 (clear) low bandwidth mode of the pll ?ter is disabled. this bit is used to isolate the loop ?ter from the vco for testing purposes. vcot is always set in user modes. this bit is writable only in bootstrap and test modes. reset sets this bit. mcs ?module clock select 1 (set) 4xclk is the source for the sci and timer divider chain. 0 (clear) extali is the source for the sci and timer divider chain. reset clears this bit. t16en ?16-bit timer clock enable (refer to section 8) 1 (set) 16-bit timer clock enabled. 0 (clear) 16-bit timer clock disabled. wen ?wait enable 1 (set) low-power wait mode selected (pll set to ?dle in wait mode). 0 (clear) do not alter the 4xclk during wait mode. this bit determines whether the 4xclk is disconnected from vcoout during wait and connected to extali. reset clears this bit. when wen is set, the cpu will respond to a wait instruction by ?st stacking the relevant registers, then by clearing bcs and setting the pll to ?dle? with modulus = 1. bwc is set so that the wide bandwidth control is selected. any interrupt, any reset, or the assertion of raf (receiver active ?g) in either of the scis will allow the pll to resume operating at the frequency speci?d in the synr. the user must set bcs after the pll has had time to adjust (t plls ). if, for a speci? sci, the re bit (receiver enable bit) is clear, then raf cannot become set, hence the pll will not resume normal operation. for a description of raf and re, see section 5. tpg 34
MC68HC11PH8 motorola 2-11 pin descriptions 2 2.5.4.2 synr ?synthesizer program register the pll frequency synthesizer multiplies the frequency of the input oscillator. the multiplication factor is software programmable via a loop divider, which consists of a six-bit modulo n counter, with a further two bit scaling factor. the multiplication factor is given by 2(y + 1)2 x , where 0 x 3 and 0 y 63. bits in synr can be read at any time but can only be written if pllon = 0. note: exceeding recommended operating frequencies can result in indeterminate mcu operation. synx[1:0] these bits program the binary taps (divide by 1, 2, 4 and 8). reset clears these bits. syny[5:0] these bits program the six-bit modulo n (1 to 64) counter. reset sets these bits to %001011. note: the resolution of the multiplication factors decreases by a factor of two, as x increases: address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset synthesizer program (synr) $002f synx1 synx0 syny5 syny4 syny3 syny2 syny1 syny0 0000 1011 x y possible multipliers 0 0 e 63 2, 4, 6, 8, , 128 1 0 e 63 4, 8, 12, 16, , 256 2 0 e 63 8, 16, 24, 32, , 512 3 0 e 63 16, 32, 48, 64, , 1024 tpg 35
motorola 2-12 MC68HC11PH8 pin descriptions 2 2.6 interrupt request (irq ) the irq input provides a means of applying asynchronous interrupt requests to the mcu. either falling edge sensitive triggering or level sensitive triggering is program selectable (option register). irq is always con?ured to level sensitive triggering at reset. note: connect an external pull-up resistor, typically 4.7 k w , to v dd when irq is used in a level sensitive wired-or con?uration. see also section 2.7. 2.7 nonmaskable interrupt (xirq / vppe ) the xirq input provides a means of requesting a nonmaskable interrupt after reset initialization. during reset, the x bit in the condition code register (ccr) is set and any interrupt is masked until mcu software enables it. because the xirq input is level-sensitive, it can be connected to a multiple-source wired-or network with an external pull-up resistor to v dd . xirq is often used as a power loss detect interrupt. whenever xirq or irq is used with multiple interrupt sources (irq must be con?ured for level sensitive operation if there is more than one source of irq interrupt), each source must drive the interrupt input with an open-drain type of driver to avoid contention between outputs. there should be a single pull-up resistor near the mcu interrupt input pin (typically 4.7 k w ). there must also be an interlock mechanism at each interrupt source so that the source holds the interrupt line low until the mcu recognizes and acknowledges the interrupt request. if one or more interrupt source is still pending after the mcu services a request, the interrupt line will still be held low and the mcu will be interrupted again as soon as the interrupt mask bit in the mcu is cleared (normally upon return from an interrupt). refer to section 10. on the mc68hc711ph8, the vppe pin is used to input the external eprom programming voltage, which must be present during eprom programming. tpg 36
MC68HC11PH8 motorola 2-13 pin descriptions 2 2.8 moda and modb (moda/lir and modb/vstby) during reset, moda and modb select one of the four operating modes. refer to section 3. after the operating mode has been selected, the lir pin provides an open-drain output (driven low) to indicate that execution of an instruction has begun. in order to detect consecutive instructions in a high-speed application, this signal drives high for a short time to prevent false triggering. a series of e clock cycles occurs during execution of each instruction. the lir signal goes low during the ?st e clock cycle of each instruction (opcode fetch). this output is provided for assistance in program debugging and its operation is controlled by the lirdv bit in the opt2 register. the vstby pin is used to input ram stand-by power. the mcu is powered from the vdd pin unless the difference between the level of vstby and vdd is greater than one mos threshold (about 0.7 volts). when these voltages differ by more than 0.7 volts, the internal 1024-byte ram and part of the reset logic are powered from vstby rather than vdd. this allows ram contents to be retained without vdd power applied to the mcu. reset must be driven low before v dd is removed and must remain low until v dd has been restored to a valid level. 2.9 vrh and vrl these pins provide the reference voltages for the analog-to-digital converter. 2.10 pg7/r/w this pin provides two separate functions, depending on the operating mode. in single chip and bootstrap modes, pg7/r/w acts as input/output port g bit 7. refer to section 4 for further information. in expanded and test modes, pg7/r/w performs the read/write function. pg7/r/w signals the direction of transfers on the external data bus. a high on this pin indicates that a read cycle is in progress. figure 2-7 ram stand-by connections 4.7k w (+) 4.8 v nicd v dd v dd v out v batt max 690 to modb/vstby pin of m68hc11 tpg 37
motorola 2-14 MC68HC11PH8 pin descriptions 2 2.11 port signals 62 pins on the device are arranged into seven 8-bit ports: a, b, c, e, f, g, and h, and one six-bit port (d). the lines of ports a, b, c, d, f, g, and h are fully bidirectional; e is input only. each of the bidirectional ports serves a purpose other than i/o, depending on the operating mode or peripheral function selected. note that ports b, c, f, and one bit of port g are available for i/o functions only in single chip and bootstrap modes. refer to table 2-2 for details of the port signals functions in different operating modes. note: when using the information about port functions, do not confuse pin function with the electrical state of the pin at reset. all general purpose i/o pins con?ured as inputs at reset are in a high-impedance state. port data registers re?ct the functional state of the port at reset. the pin function is mode dependent. 2.11.1 port a port a is an 8-bit general purpose i/o port with a data register (porta) and a data direction register (ddra). port a pins share functions with the 16-bit timer system (see section 8 for further information). porta can be read at any time and always returns the pin level. if written, porta stores the data in internal latches. the pins are driven only if they are con?ured as outputs. writes to porta do not change the pin state when the pins are con?ured for timer output compares. out of reset, port a pins [7:0] are general purpose high-impedance inputs. when the functions associated with these pins are disabled, the bits in ddra govern the i/o state of the associated pin. for further information, refer to section 4. 2.11.2 port b port b is an 8-bit general purpose i/o port with a data register (portb) and a data direction register (ddrb). in single chip mode, port b pins are general purpose i/o pins (pb[7:0]). in expanded mode, port b pins act as the high-order address lines (a[15:8]) of the address bus. in either of these modes, the four high-order port b pins (b[7:4]) may be con?ured to drive four lcd segments (see section 2.12) portb can be read at any time and always returns the pin level. if portb is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs in single chip or bootstrap mode. for further information, refer to section 4. port b pins include on-chip pull-up devices which can be enabled or disabled via the port pull-up assignment register (ppar). tpg 38
MC68HC11PH8 motorola 2-15 pin descriptions 2 table 2-2 port signal functions port/bit single chip and bootstrap mode expanded multiplexed and special test mode pa0 pa0/ic3 pa1 pa1/ic2 pa2 pa2/ic1 pa3 pa3/oc5/ic4 and/or oc1 pa4 pa4/oc4 and/or oc1 pa5 pa5/oc3 and/or oc1 pa6 pa6/oc2 and/or oc1 pa7 pa7/pai and/or oc1 pb[3:0] pb[3:0] a[11:8] pb4 pb4/lcd4 a12/lcd4 pb5 pb5/lcd5 a13/lcd5 pb6 pb6/lcd6 a14/lcd6 pb7 pb7/lcd7 a15/lcd7 pc[7:0] pc[7:0] d[7:0] pd0 pd0/rxd1 pd1 pd1/txd1 pd2 pd2/miso1 pd3 pd3/mosi1 pd4 pd4/sck1 pd5 pd5/ss 1 pe[7:0] input only or analog inputs pf[7:0] pf[7:0] a[7:0] pg0 pg0/rxd2 pg1 pg1/txd2 pg2 pg2/miso2 pg3 pg3/mosi2 pg4 pg4/sck2 pg5 pg5/ss 2 pg6 pg6/lcdbp pg7 pg7 r/w ph0 ph0/pw1 ph1 ph1/pw2 ph2 ph2/pw3 ph3 ph3/pw4 ph4 ph4 ph5 ph5 ph6 ph6/modulus timer c clock input ph7 ph7/modulus timer b clock input tpg 39
motorola 2-16 MC68HC11PH8 pin descriptions 2 2.11.3 port c port c is an 8-bit general purpose i/o port with a data register (portc) and a data direction register (ddrc). in single chip mode, port c pins are general purpose i/o pins (pc[7:0]). in the expanded mode, port c pins are con?ured as data bus pins (d[7:0]). portc can be read at any time and always returns the pin level. if portc is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs in single chip or bootstrap mode. port c pins are general purpose inputs out of reset in single chip and bootstrap modes. in expanded and test modes, these pins are data bus lines out of reset. the cwom control bit in the opt2 register disables port cs p-channel output drivers. because the n-channel driver is not affected by cwom, setting cwom causes port c to become an open-drain-type output port suitable for wired-or operation. in wired-or mode (portc bits at logic level zero), the pins are actively driven low by the n-channel driver. when a port c bit is at logic level one, the associated pin is in a high impedance state as neither the n-channel nor the p-channel devices are active. it is customary to have an external pull-up resistor on lines that are driven by open-drain devices. port c can only be con?ured for wired-or operation when the mcu is in single chip mode. for further information, refer to section 4. 2.11.4 port d port d, a 6-bit general purpose i/o port, has a data register (portd) and a data direction register (ddrd). the six port d lines (d[5:0]) can be used for general purpose i/o, for one of the serial communications interfaces (sci1, pins [1,0]) and for one of the serial peripheral interfaces (spi1, pins [5:2]). portd can be read at any time; inputs return the pin level and outputs return the pin driver input level. if portd is written, the data is stored in internal latches. the pins are driven only if port d is con?ured for general purpose output. the dwom bit in spcr disables the p-channel output drivers of pins d[5:2], and the woms bit in sccr1 disables those of pins d[1,0]. because the n-channel driver is not affected by dwom or woms, setting either bit causes the corresponding port d pins to become open-drain-type outputs suitable for wired-or operation. in wired-or mode (portd bits at logic level zero), the pins are actively driven low by the n-channel driver. when a port d bit is at logic level one, the associated pin is in a high impedance state as neither the n-channel nor the p-channel devices are active. it is customary to have an external pull-up resistor on lines that are driven by open-drain devices. port d can be con?ured for wired-or operation when the mcu is in single chip mode or expanded mode. for further information, refer to section 4, section 5 (sci) and section 7 (spi). tpg 40
MC68HC11PH8 motorola 2-17 pin descriptions 2 2.11.5 port e port e, pe/ad[7:0], is an input-only port that can also be used as the analog inputs for the analog-to-digital converter. for further information, refer to section 4 and section 9 (a/d). 2.11.6 port f port f is an 8-bit general purpose i/o port with a data register (portf) and a data direction register (ddrf). in single chip mode, port f pins are general purpose i/o pins (pf[7:0]). in expanded mode, port f pins act as the low-order address lines (a[7:0]) of the address bus. portf can be read at any time and always returns the pin level. if portf is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs in single chip or bootstrap mode. port f pins include on-chip pull-up devices that can be enabled or disabled via the port pull-up assignment register (ppar). for further information, refer to section 4. 2.11.7 port g in normal modes, port g is an 8-bit general purpose i/o port with a data register (portg) and a data direction register (ddrg). port g pin 7 is the r/w line in expanded mode; pin 6 can be used for the lcd backplane signal (lcdbp) in any mode; the remaining pins can be used for general purpose i/o, for one of the sci subsystems (sci2 with mi-bus, pins [1,0]), or for one of the serial peripheral interface subsystems (spi2, pins [5:2]). portg can be read at any time; inputs return the pin level and outputs return the pin driver input level. if portg is written, the data is stored in internal latches. the pins are driven only if they are con?ured as outputs (and only in single chip or bootstrap mode for pins g[7,6]). the gwom bit in sp2cr disables the p-channel output drivers of pins g[5:2], and the woms2 bit in s2cr1 disables those of pins g[1,0]. because the n-channel driver is not affected by gwom or woms2, setting either bit causes the corresponding port g pins to become open-drain-type outputs suitable for wired-or operation. in wired-or mode (appropriate portg bits at logic level zero), the pins are actively driven low by the n-channel driver. when a port g bit is at logic level one, the associated pin is in a high impedance state as neither the n-channel nor the p-channel devices are active. it is customary to have an external pull-up resistor on lines that are driven by open-drain devices. port g pins [5:0] can be con?ured for wired-or operation when the mcu is in single chip mode or expanded mode. port g pins include on-chip pull-up devices that can be enabled or disabled via the port pull-up assignment register (ppar). for further information, refer to section 4, section 5 (sci), section 6 (mi bus) and section 7 (spi). tpg 41
motorola 2-18 MC68HC11PH8 pin descriptions 2 2.11.8 port h port h is an 8-bit general purpose i/o port with a data register (porth) and a data direction register (ddrh). port h pins support either input/output, pulse-width modulation channels (pins [3:0]) or act as clock inputs for two of the 8-bit modulus timers (pins [7,6]). porth can be read at any time and always returns the pin level. port h pins include on-chip pull-up devices that can be enabled or disabled via the port pull-up assignment register (ppar). port h pins can be con?ured for wired-or interrupt to wake-up from wait or stop mode under control of the wired-or interrupt register (woieh). for further information, refer to section 4 and section 8 (timer system). 2.12 lcd module the MC68HC11PH8 incorporates an lcd module that allows four lcd segments to be driven under control of the lcd control and data register. the four frontplane signals are output on port b pins [7:4], with the backplane signal output on pg6. a segment is on when the corresponding frontplane and backplane are equal in frequency and opposite in phase. the lcd function can be enabled in any mode. 2.12.1 lcdr ?lcd control and data register lcd[7:4] ?lcd segment data 1 (set) segment on (corresponding lcd output port b is opposite in phase to lcdbp). 0 (clear) segment off (corresponding lcd output port b is in phase with lcdbp). when lcd[7:4] are all cleared, the lcd backplane is forced low ? and all the lcd segments are off, thus reducing power consumption and rfi emissions. ? this is not the case on early versions of the mc68hc711ph8; contact your local motorola sales representative for more information. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset lcd control and data (lcdr) $002d lcd7 lcd6 lcd5 lcd4 0 0 lcdck lcde 0000 0000 tpg 42
MC68HC11PH8 motorola 2-19 pin descriptions 2 lcdck ?lcd frequency clock select 1 (set) the clock source of the real time interrupt (rti) toggles lcdbp. 0 (clear) 8-bit modulus timer a under?w (clk64) toggles lcdbp. when the pll clock generation circuit is not used (vddsyn = 0), setting lcdck selects the st4xck clock divided by 2 18 as the lcd clock source. conversely, when the pll clock generation circuit is used (vddsyn = 1), setting lcdck selects the output of the 8-bit modulus timer a divided by 2 3 (clk64/2 3 ) as the lcd clock source. refer to section 8. lcde ?lcd function enable 1 (set) lcd function enabled. 0 (clear) lcd function disabled. the lcde bit can be written only once (the ?st write to this register after reset will prevent later updates of this bit). when enabled, this function will force pg6 into output mode. this output will be the backplane signal (lcdbp) for the four lcd segments. the four port b pins (pb[7:4]) used to drive the lcd segments will also be forced into output mode. if enabled in expanded modes, pb[7:4] will operate as lcd outputs, while pb3 to pb0 output the address lines to access external resources. to avoid con?cts caused by the lcde bit being set accidentally by program error, it is recommended that the lcde bit be written to zero if the lcd function is not required. tpg 43
motorola 2-20 MC68HC11PH8 pin descriptions this page intentionally left blank 2 tpg 44
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-1 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3 operating modes and on-chip memory this section contains information about the modes that de?e MC68HC11PH8 operating conditions, and about the on-chip memory that allows the mcu to be con?ured for various applications. 3.1 operating modes the values of the mode select inputs modb and moda during reset determine the operating mode (see table 3-4). single chip and expanded modes are the normal modes. in single chip mode only on-board memory is available. expanded mode, however, allows access to external memory. each of these two normal modes is paired with a special mode. bootstrap, a variation of the single chip mode, is a special mode that executes a bootloader program in an internal bootstrap rom. test is a special mode that allows privileged access to internal resources. 3.1.1 single chip operating mode in single chip operating mode, the MC68HC11PH8 microcontroller has no external address or data bus. ports b, c, f, and the r/w pin are available for general purpose parallel i/o. 3.1.2 expanded operating mode in expanded operating mode, the mcu can access a 64k byte physical address space. the address space includes the same on-chip memory addresses used for single chip mode, in addition to external memory and peripheral devices. the expansion bus is made up of ports b, c, and f, and the r/w signal. in expanded mode, high order address bits are output on the port b pins, low order address bits on the port f pins, and the data bus on port c. the r/w /pg7 pin signals the direction of data transfer on the port c bus. when internal resources are accessed in expanded mode, the last external address can be held on the output pins (a[15:0]) in order to reduce radio-frequency interference (rfi) emissions. this function is controlled by the freez bit in the config register. see section 3.3.2.1 for a description of this bit. to allow access to slow peripherals, off chip accesses can be extended by one e clock cycle, under control of the strch and strx bits (in the opt2 and init2 registers respectively). the e clock tpg 45
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-2 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 stretches externally, but the internal clocks are not affected so that timers and serial systems are not corrupted. see section 3.3.2.5. eeprom data can be protected while in expanded mode, using a security feature described in section 3.4.4. 3.1.3 special test -mode special test, a variation of the expanded mode, is primarily used during motorolas internal production testing; however, it is accessible for programming the config register, programming calibration data into eeprom, and supporting emulation and debugging during development. 3.1.4 special bootstrap mode when the mcu is reset in special bootstrap mode, a small on-chip rom is enabled at address $be40?bfff. the rom contains a reset vector and a bootloader program. the mcu fetches the reset vector, then executes the bootloader. for normal use of the bootloader program, send a synchronization byte $ff to the sci receiver at either e clock ? 256, or e clock ? 1664 (7812 or 1200 baud respectively, for an e clock of 2mhz). then download up to 2048 bytes of program data (which is put into ram starting at $0080). these characters are echoed through the transmitter. the bootloader program ends the download after a timeout of four character times or 2048 bytes. when loading is complete, the program jumps to location $0080 and begins executing the code. use of an external pull-up resistor is required when using the sci transmitter pin (txd) because port d pins are con?ured for wired-or operation by the bootloader. in bootstrap mode, the interrupt vectors point to ram. this allows the use of interrupts through a jump table. further baud rate options are available on the MC68HC11PH8 by using a different value for the synchronization byte, as shown in the table 3-1. a special mode exists that allows a low frequency crystal to be used if the pll is active. in this case, the value on port f is loaded into the synr register just after reset, to be used as the multiplication factor for the crystal frequency. if the pll is not active, then the bootloader runs at the crystal frequency. refer to section 2.5 for more information on the operation of the pll circuitry. refer also to motorola application note an1060, m68hc11 bootstrap mode (the bootloader mode is similar to that used on the mc68hc11k4). tpg 46
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-3 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.2 on-chip memory the MC68HC11PH8 mcu includes 2k bytes of on-chip ram, 48k bytes of rom/ eprom and 768 bytes of eeprom. the bootloader rom occupies a 512 byte block of the memory map. the config register is implemented as a separate eeprom byte. table 3-1 example bootloader baud rates sync. byte timeou t delay baud rates for an e clock of: 2.00mhz 2.10mhz 3.00mhz 3.15mhz 4.00mhz $ff 4 char. 7812 8192 11718 12288 15624 $ff 4 1200 1260 1800 1890 2400 $f0 4.9 9600 10080 14400 15120 19200 $fd 17.3 5208 5461 7812 8192 10416 $fd 13 3906 4096 5859 6144 7812 figure 3-1 MC68HC11PH8/ mc68hc711ph8 memory map single chip expanded special bootstrap special test start address $0000 $0080 $0880 $0d00 $1000 $4000 $ffc0 ?$ffff $be40 $c000 each of these blocks can be mapped to any 4k page boundary, using the init register. ? ? this block may be remapped to any 4k page, using init2. special bootstrap mode only. special modes only. 48k bytes rom (MC68HC11PH8) or 48k bytes eprom (mc68hc711ph8) . can be mapped to either $0000e$bfff or $4000e$ffff, using the config register. normal mode vectors. vectors nvm 48k bytes vectors bootrom eeprom 768 bytes ram 2k bytes register block $x000 $x07f $x080 $x87f $xd00 $xfff $be40 $bfff $4000 $ffff $ffbf tpg 47
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-4 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.2.1 mapping allocations memory locations for on-chip resources are the same for both expanded and single chip modes. the 128-byte register block originates at $0000 after reset and can be placed at any other 4k boundary ($x000) after reset by writing an appropriate value to the init register. refer to figure 3-1, which shows the memory map. the on-board 2k byte ram is initially located at $0080 after reset. the ram is divided into two sections, of 128 bytes and 1920 bytes. if ram and registers are both mapped to the same 4k boundary, ram starts at $x080 and 128 bytes are remapped at $x800?x87f. otherwise, ram starts at $x000. see figure 3-3. remapping is accomplished by writing appropriate values into the two nibbles of the init register. see section 3.3.2.2. the 768-byte eeprom is initially located at $0d00 after reset, when eeprom is enabled in the memory map by the config register. eeprom can be placed in any other 4k page ($xd00) by writing to the init2 register. the romad and romon bits in the config register control the position and presence of rom, or eprom , in the memory map. in special test mode, the romon bit is cleared so the rom is removed from the memory map. in single chip mode, the romad bit is set to one after reset, which enables the rom at $4000?ffff. in expanded mode, the rom may be enabled from $0000?bfff (romad = 0) to allow an external memory to contain the interrupt vectors and initialization code. in special bootstrap mode, a bootloader rom is enabled at locations $be40?bfff. the vectors for special bootstrap mode are contained in the bootloader program. the boot rom occupies a 512 byte block of the memory map, though not all locations are used. 3.2.1.1 ram the MC68HC11PH8 has 2k bytes of fully static ram that are used for storing instructions, variables and temporary data during program execution. ram can be placed at any 4k boundary in the 64k byte address space by writing an appropriate value to the init register. by default, ram is initially located at $0080 in the memory map. direct addressing mode can access the ?st 128 locations of ram using a one-byte address operand. direct mode accesses save program memory space and execution time. registers can be moved to other boundaries to allow 256 bytes of ram to be located in direct addressing space. see figure 3-3. the on-chip ram is a fully static memory. ram contents can be preserved during periods of processor inactivity by either of two methods, both of which reduce power consumption: tpg 48
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-5 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1) during the software-based stop mode, mcu clocks are stopped, but the mcu continues to draw power from v dd . power supply current is directly related to operating frequency in cmos integrated circuits and there is very little leakage when the clocks are stopped. these two factors reduce power consumption while the mcu is in stop mode. 2) to reduce power consumption to a minimum, v dd can be turned off, and the modb/vstby pin can be used to supply ram power from either a battery back-up or a second power supply. although this method requires external hardware, it is very effective. refer to section 2 for information about how to connect the stand-by ram power supply and to section 10 for a description of low power operation. 3.2.1.2 rom and eprom the mcu has 48k bytes of rom/ eprom . the rom/ eprom array is enabled when the romon bit in the config register is set to one (erased). the romad bit in config places the rom/ eprom at either $4000?ffff (romad = 1) or at $0000?bfff (romad = 0) when coming out of reset in expanded mode. 3.2.1.3 bootloader rom the bootloader rom is enabled at address $be40?bfff during special bootstrap mode. the reset vector is fetched from this rom and the mcu executes the bootloader ?mware. in normal modes, the bootloader rom is disabled. 3.2.2 registers in table 3-2, a summary of registers and control bits, the registers are shown in ascending order within the 128-byte register block. the addresses shown are for default block mapping ($0000?007f), however, the init register remaps the block to any 4k page ($x000?x07f). see section 3.3.2.2. tpg 49
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-6 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 table 3-2 register and control bit assignments (sheet 1 of 4) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 undetned data direction a (ddra) $0001 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 0000 0000 data direction b (ddrb) $0002 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 0000 0000 data direction f (ddrf) $0003 ddf7 ddf6 ddf5 ddf4 ddf3 ddf2 ddf1 ddf0 0000 0000 port b data (portb) $0004 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 undetned port f data (portf) $0005 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 undetned port c data (portc) $0006 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 undetned data direction c (ddrc) $0007 ddc7 ddc6 ddc5 ddc4 ddc3 ddc2 ddc1 ddc0 0000 0000 port d data (portd) $0008 0 0 pd5 pd4 pd3 pd2 pd1 pd0 undetned data direction d (ddrd) $0009 0 0 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 0000 0000 port e data (porte) $000a pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 undetned timer compare force (cforc) $000b foc1 foc2 foc3 foc4 foc5 0 0 0 0000 0000 output compare 1 mask (oc1m) $000c oc1m7 oc1m6 oc1m5 oc1m4 oc1m3 0 0 0 0000 0000 output compare 1 data (oc1d) $000d oc1d7 oc1d6 oc1d5 oc1d4 oc1d3 0 0 0 0000 0000 timer count (tcnt) high $000e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer count (tcnt) low $000f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 timer input capture 1 (tic1) high $0010 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) undetned timer input capture 1 (tic1) low $0011 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned timer input capture 2 (tic2) high $0012 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) undetned timer input capture 2 (tic2) low $0013 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned timer input capture 3 (tic3) high $0014 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) undetned timer input capture 3 (tic3) low $0015 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned timer output compare 1 (toc1) high $0016 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 1 (toc1) low $0017 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 2 (toc2) high $0018 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 2 (toc2) low $0019 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 3 (toc3) high $001a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 3 (toc3) low $001b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 4 (toc4) high $001c (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 4 (toc4) low $001d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 capture 4/compare 5 (ti4/o5) high $001e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 capture 4/compare 5 (ti4/o5) low $001f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer control 1 (tctl1) $0020 om2 ol2 om3 ol3 om4 ol4 om5 ol5 0000 0000 timer control 2 (tctl2) $0021 edg4b edg4a edg1b edg1a edg2b edg2a edg3b edg3a 0000 0000 timer interrupt mask 1 (tmsk1) $0022 oc1i oc2i oc3i oc4i i4/o5i ic1i ic2i ic3i 0000 0000 tpg 50
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-7 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 timer interrupt ?ag 1 (tflg1) $0023 oc1f oc2f oc3f oc4f i4/o5f ic1f ic2f ic3f 0000 0000 timer interrupt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 timer interrupt ?ag 2 (tflg2) $0025 tof rtif paovf paif 0000 0000 0000 pulse accumulator control (pactl) $0026 0 paen pamod pedge 0 i4/o5 rtr1 rtr0 0000 0000 pulse accumulator count (pacnt) $0027 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned spi control (spcr) $0028 spie spe dwom mstr cpol cpha spr1 spr0 0000 01uu spi status (spsr) $0029 spif wcol 0 modf 0000 0000 0000 spi data (spdr) $002a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned eprom programming (eprog) $002b mbe 0 elat excol exrow 0 0 epgm 0000 0000 port pull-up assignment (ppar) $002c 0 0 0 hwoif hppue gppue fppue bppue 0000 1111 lcd control and data (lcdr) $002d lcd7 lcd6 lcd5 lcd4 0 0 lcdck lcde 0000 0000 pll control (pllcr) $002e pllon bcs auto bwc vcot mcs t16en wen x010 1010 synthesizer program (synr) $002f synx1 synx0 syny5 syny4 syny3 syny2 syny1 syny0 0000 1011 a/d control & status (adctl) $0030 ccf 0 scan mult cd cc cb ca u0uu uuuu a/d result 1 (adr1) $0031 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned a/d result 2 (adr2) $0032 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned a/d result 3 (adr3) $0033 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned a/d result 4 (adr4) $0034 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned block protect (bprot) $0035 bulkp 0 bprt4 ptcon bprt3 bprt2 bprt1 bprt0 1011 1111 reserved $0036 eeprom mapping (init2) $0037 ee3 ee2 ee1 ee0 strx 0 m2dl1 m2dl0 0000 0000 system contg. options 2 (opt2) $0038 lirdv cwom strch irvne lsbf spr2 ext4x dise x00x 0000 system contg. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 cop timer arm/reset (coprst) $003a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned eeprom programming (pprog) $003b odd even 0 byte row erase eelat eepgm 0000 0000 highest priority interrupt (hprio) $003c rboot smod mda psel4 psel3 psel2 psel1 psel0 xxx0 0110 ram & i/o mapping (init) $003d ram3 ram2 ram1 ram0 reg3 reg2 reg1 reg0 0000 0000 factory test (test1) $003e tilop pltst occr cbyp disr fcm fcop midly 0000 0000 contguration control (config) $003f romad freez clk4x paren nosec nocop romon eeon xxxx xxxx reserved $0040 reserved $0041 reserved $0042 reserved $0043 reserved $0044 reserved $0045 table 3-2 register and control bit assignments (sheet 2 of 4) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset tpg 51
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-8 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 reserved $0046 reserved $0047 reserved $0048 reserved $0049 reserved $004a reserved $004b spi2 control (sp2cr) $004c sp2ie sp2e gwom mstr2 cpol2 cpha2 sp2r1 sp2r0 0000 01uu spi2 status (sp2sr) $004d sp2if wcol2 0 modf2 0000 0000 0000 spi2 data (sp2dr) $004e (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned spi2 control options (sp2opt) $004f 0000 lsbf2 sp2r2 0 0 0000 0000 sci2/mi baud high (s2bdh) $0050 b2tst b2spl b2rst s2b12 s2b11 s2b10 s2b9 s2b8 0000 0000 sci2/mi baud low (s2bdl) $0051 s2b7 s2b6 s2b5 s2b4 s2b3 s2b2 s2b1 s2b0 0000 0100 sci2/mi control 1 (s2cr1) $0052 lops2 woms2 mie2 m2 wake2 ilt2 pe2 pt2 0000 0000 sci2/mi control 2 (s2cr2) $0053 tie2 tcie2 rie2 ilie2 te2 re2 rwu2 sbk2 0000 0000 sci2/mi status 1 (s2sr1) $0054 tdre2 tc2 rdrf2 idle2 or2 nf2 fe2 pf2 1100 0000 sci2/mi status 2 (s2sr2) $0055 0000000 raf2 0000 0000 sci2/mi data high (s2drh) $0056 r8b t8b 000000 undetned sci2/mi data low (s2drl) $0057 r7t7b r6t6b r5t5b r4t4b r3t3b r2t2b r1t1b r0t0b undetned reserved $0058 8-bit modulus timer a data (t8adr) $0059 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 8-bit modulus timer b data (t8bdr) $005a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned 8-bit modulus timer c data (t8cdr) $005b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned reserved $005c 8-bit modulus timer a control (t8acr) $005d t8ai t8af 0 0 0 csa2 csa1 csa0 0000 0000 8-bit modulus timer b control (t8bcr) $005e t8bi t8bf 0 0 prb csb2 csb1 csb0 0000 0000 8-bit modulus timer c control (t8ccr) $005f t8ci t8cf 0 0 prc csc2 csc1 csc0 0000 0000 pulse width clock select (pwclk) $0060 con34 con12 pcka2 pcka1 0 pckb3 pckb2 pckb1 0000 0000 pulse width polarity select (pwpol) $0061 pclk4 pclk3 pclk2 pclk1 ppol4 ppol3 ppol2 ppol1 0000 0000 pulse width scale (pwscal) $0062 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width enable (pwen) $0063 tpwsl discp 0 0 pwen4 pwen3 pwen2 pwen1 0000 0000 pulse width count 1 (pwcnt1) $0064 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 2 (pwcnt2) $0065 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 3 (pwcnt3) $0066 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 4 (pwcnt4) $0067 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width period 1 (pwper1) $0068 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 table 3-2 register and control bit assignments (sheet 3 of 4) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset tpg 52
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-9 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 pulse width period 2 (pwper2) $0069 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width period 3 (pwper3) $006a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width period 4 (pwper4) $006b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 1 (pwdty1) $006c (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 2 (pwdty2) $006d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 3 (pwdty3) $006e (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 4 (pwdty4) $006f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 sci1 baud rate high (scbdh) $0070 btst bspl brst sbr12 sbr11 sbr10 sbr9 sbr8 0000 0000 sci1 baud rate low (scbdl) $0071 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 0000 0100 sci1 control 1 (sccr1) $0072 loops woms 0 m wake ilt pe pt 0000 0000 sci1 control 2 (sccr2) $0073 tie tcie rie ilie te re rwu sbk 0000 0000 sci1 status 1 (scsr1) $0074 tdre tc rdrf idle or nf fe pf 1100 0000 sci1 status 2 (scsr2) $0075 0000000raf 0000 0000 sci1 data high (scdrh) $0076 r8 t8 000000 undetned sci1 data low (scdrl) $0077 r7t7 r6t6 r5t5 r4t4 r3t3 r2t2 r1t1 r0t0 undetned reserved $0078 reserved $0079 reserved $007a wired-or interrupt enable (woieh) $007b ieh7 ieh6 ieh5 ieh4 ieh3 ieh2 ieh1 ieh0 0000 0000 port h data (porth) $007c ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 undetned data direction h (ddrh) $007d ddh7 ddh6 ddh5 ddh4 ddh3 ddh2 ddh1 ddh0 0000 0000 port g data (portg) $007e pg7 pg6 pg5 pg4 pg3 pg2 pg1 pg0 undetned data direction g (ddrg) $007f ddg7 ddg6 ddg5 ddg4 ddg3 ddg2 ddg1 ddg0 0000 0000 table 3-2 register and control bit assignments (sheet 4 of 4) register name address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset key applies only to eprom devices x state on reset depends on mode selected u state of bit on reset is undetned tpg 53
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-10 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.3 system initialization registers and bits that control initialization and the basic operation of the mcu are protected against writes except under special circumstances. the following table lists registers that can be written only once after reset, or that must be written within the ?st 64 cycles after reset. 3.3.1 mode selection the four mode variations are selected by the logic states of the mode a (moda) and mode b (modb) pins during reset. the moda and modb logic levels determine the logic state of special mode (smod) and the mode a (mda) control bits in the highest priority i-bit interrupt and miscellaneous (hprio) register. after reset is released, the mode select pins no longer in?ence the mcu operating mode. in single chip operating mode, moda pin is connected to a logic zero. in expanded mode, moda is normally connected to v dd through a pull-up resistor of 4.7 k w . the moda pin also functions as the load instruction register (lir ) pin when the mcu is not in reset. the open-drain active low lir output pin drives low during the ?st e cycle of each instruction, if enabled by the lirdv bit in the opt2 register. the modb pin also functions as the stand-by power input (vstby), which allows the ram contents to be maintained in the absence of v dd . (1) when smod = 0, bits 1 and 0 can be written only once, during the trst 64 cycles, after which they become read-only. when smod = 1, however, these bits can be written at any time. all other bits can be written at any time. (2) bit 0 (lcde) can be written only once. (3) bits can be written to zero once and only in the trst 64 cycles or in special modes. bits can be set to one at any time. (4) bit 0 (dise) and bit 1 (ext4x) can be written only once; bit 4 (irvne) can be written only once in single chip and user expanded modes. (5) bits 5, 4, 2, 1, and 0 can be written once and only in the trst 64 cycles; when smod = 1, however, bits 5, 4, 2, 1, and 0 can be written at any time. all other bits can be written at any time. (6) when smod = 0, bits can be written only once, during the trst 64 cycles, after which the register becomes read-only. when smod = 1, bits can be written at any time. table 3-3 registers with limited write access register address register name must be written in trst 64 cycles write once only $x024 timer interrupt mask register 2 (tmsk2) (1) ? $x02d lcd control and data register (lcdr) no (2) $x035 block protect register (bprot) (3) ? $x037 eeprom mapping register (init2) no yes $x038 system contguration options register 2 (opt2) no (4) $x039 system contguration options register (option) (5) ? $x03d ram and i/o map register (init) (6) ? tpg 54
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-11 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 refer to table 3-4, which is a summary of mode pin operation, the mode control bits and the four operating modes. a normal mode is selected when modb is logic one during reset. one of three reset vectors is fetched from address $fffa?ffff, and program execution begins from the address indicated by this vector. if modb is logic zero during reset, the special mode reset vector is fetched from addresses $bffa?bfff and software has access to special test features. refer to section 10. 3.3.1.1 hprio ?highest priority i-bit interrupt & misc. register note: rboot, smod and mda bits depend on the power-up initialization mode and can only be written in special modes when smod = 1. refer to table 3-4. rboot ?read bootstrap rom 1 (set) bootloader rom enabled, at $be40?bfff. 0 (clear) bootloader rom disabled and not in map. smod ?special mode select 1 (set) special mode variation in effect. 0 (clear) normal mode variation in effect. once cleared, cannot be set again. mda ?mode select a 1 (set) normal expanded or special test mode. (expanded buses active.) 0 (clear) normal single chip or special bootstrap mode. (ports active.) psel[4:0] ?priority select bits (refer to section 10) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset highest priority interrupt (hprio) $003c rboot smod mda psel4 psel3 psel2 psel1 psel0 xxx0 0110 table 3-4 hardware mode select summary inputs mode control bits in hprio (latched at reset) modb moda rboot smod mda 1 0 single chip 0 0 0 1 1 expanded 0 0 1 0 0 special bootstrap 1 1 0 0 1 special test 0 1 1 tpg 55
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-12 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.3.2 initialization because bits in the following registers control the basic con?uration of the mcu, an accidental change of their values could cause serious system problems. the protection mechanism, overridden in special operating modes, requires a write to the protected bits only within the ?st 64 bus cycles after any reset, or only once after each reset. see table 3-3. 3.3.2.1 config ?system con?uration register config controls the presence and/or location of rom/ eprom and eeprom in the memory map and enables the cop watchdog system.the freez bit provides a method of reducing rfi emissions in expanded mode, the clk4x bit enables the 4xout pin to output either 4xclk or the internal extal signal (extali), and the paren bit enables pull-ups on certain ports. a security feature that protects data in eeprom and ram is available, controlled by the nosec bit. refer to section 3.4.4. config is made up of eeprom cells and static working latches. the operation of the mcu is controlled directly by these latches and not the eeprom byte. when programming the config register, the eeprom byte is accessed. when the config register is read, the static latches are accessed. these bits can be read at any time. the value read is the one latched into the register from the eeprom cells during the last reset sequence. a new value programmed into this register is not readable until after a subsequent reset sequence. on the mc68hc711ph8 , and on the MC68HC11PH8 if selected by a mask option, the romon bit can be written at any time if mda = 1 (expanded mode or special test mode). it cannot be written in bootstrap mode, and is forced to a logic one in single chip mode. other bits in config can be written at any time if smod = 1 (bootstrap or special test mode). if smod = 0 (single chip or expanded mode), these bits can only be written using the eeprom programming sequence, and none of the bits are readable or active until latched via the next reset. freez is only active in expanded user mode. romad ?rom mapping control 1 (set) rom/ eprom addressed from $4000 to $ffff. 0 (clear) rom/ eprom addressed from $0000 to $bfff (expanded mode only). in single chip mode, reset sets this bit. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset contguration control (config) $003f romad freez clk4x paren nosec nocop romon eeon xxxx xxxx tpg 56
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-13 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 freez ?address bus freeze in expanded user mode 1 (set) the external bus is only active when externally mapped resources are accessed (expanded mode only). 0 (clear) normal operation. to reduce rfi emissions, the address bus (on ports b and f) is not active while internal resources are being accessed, but will instead freeze on the last external address. at this time, the data bus port c is three-stated (high impedance) with weak pull-ups active, r/w is forced high and the e clock enable is pulled low. at reset, the address bus is initialized to $fffe. refer to figure 3-2. clk4x ?4x clock enable 1 (set) 4xclk or extali driven out on the 4xout pin (see section 3.3.2.5) 0 (clear) 4xout pin disabled. note: the 4xout pin is not available on 84-pin packaged devices. paren ?pull-up assignment register enable (refer to section 4) 1 (set) pull-ups can be enabled using ppar. 0 (clear) all pull-ups disabled (not controlled by ppar). figure 3-2 example of expanded mode freez actions internal e immp e addr data r/w internal external internal in out (resistive pull-up) (internal signal) tpg 57
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-14 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 nosec ?eeprom security disabled (refer to section 3.4.4) 1 (set) disable security. 0 (clear) enable security. nocop ?cop system disable (refer to section 10) 1 (set) cop system disabled. 0 (clear) cop system enabled (forces reset on timeout). romon ?rom enable 1 (set) rom/ eprom included in the memory map. 0 (clear) rom/ eprom excluded from the memory map. in single chip mode, reset sets this bit. in special test mode, reset clears romon. on the mc68hc711ph8 , and on the MC68HC11PH8 if selected by a mask option, romon can be modi?d in expanded and special test modes. in this case, care must be taken to include reset and interrupt vectors in both internal and external memory maps. the routines for altering romon should not be located at addresses in the internal rom/ eprom memory range, but rather at different external rom/ eprom addresses or in internal eeprom. eeon ?eeprom enable 1 (set) eeprom included in the memory map. 0 (clear) eeprom is excluded from the memory map. 3.3.2.2 init ?ram and i/o mapping register the internal registers used to control the operation of the mcu can be relocated on 4k boundaries within the memory space with the use of init. this 8-bit special-purpose register can change the default locations of the ram and control registers within the mcu memory map. it can be written to only once within the ?st 64 e clock cycles after a reset. it then becomes a read-only register. ram[3:0] ?ram map position these four bits, which specify the upper hexadecimal digit of the ram address, control the position of the ram in the memory map. the ram can be positioned at the beginning of any 4k page in the memory map. refer to table 3-5. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset ram & i/o mapping (init) $003d ram3 ram2 ram1 ram0 reg3 reg2 reg1 reg0 0000 0000 tpg 58
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-15 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 reg[3:0] ?128-byte register block position these four bits specify the upper hexadecimal digit of the address for the 128-byte block of internal registers. the register block is positioned at the beginning of any 4k page in the memory map. refer to table 3-5. when the memory map has the 128-byte register block mapped at the same location as ram, the registers have priority and the ram is relocated to the memory space immediately following the register block. this mapping feature keeps all the ram available for use. refer to figure 3-3, which illustrates the overlap. table 3-5 ram and register remapping ram[3:0] location reg[3:0] location 0000 $0000e$07ff 0000 $0000e$007f 0001 $1000e$17ff 0001 $1000e$107f 0010 $2000e$27ff 0010 $2000e$207f 0011 $3000e$37ff 0011 $3000e$307f 0100 $4000e$47ff 0100 $4000e$407f 0101 $5000e$57ff 0101 $5000e$507f 0110 $6000e$67ff 0110 $6000e$607f 0111 $7000e$77ff 0111 $7000e$707f 1000 $8000e$87ff 1000 $8000e$807f 1001 $9000e$97ff 1001 $9000e$907f 1010 $a000e$a7ff 1010 $a000e$a07f 1011 $b000e$b7ff 1011 $b000e$b07f 1100 $c000e$c7ff 1100 $c000e$c07f 1101 $d000e$d7ff 1101 $d000e$d07f 1110 $e000e$e7ff 1110 $e000e$e07f 1111 $f000e$f7ff 1111 $f000e$f07f figure 3-3 ram and register overlap $x000 $x07f $x080 $x7ff $x800 $x87f ram b ram a register block $x000 $x07f $x080 $x7ff ram b ram a register and ram mapped to different 4k boundaries. register and ram mapped to the same 4k boundary. tpg 59
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-16 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.3.2.3 init2 ?eeprom mapping and mi bus delay register this register determines the location of eeprom in the memory map and controls stretching of external accesses. init2 may be read at any time but bits 7? may be written only once after reset in normal modes (bits 3, 1 and 0 may be written at any time). ee[3:0] ?eeprom map position eeprom is located at $xd00?xfff, where x is the hexadecimal digit represented by ee[3:0]. refer to table 3-6. strx ?stretch extended ? 1 (set) all external accesses are extended by one e clock cycle. 0 (clear) only external access from $0000 to $1fff (romad set) or from $c000 to $dfff (romad clear) are extended by one e clock cycle. this bit only has meaning in expanded mode, and only if the strch bit in opt2 is set (see section 3.3.2.5). bit 2 ?not implemented; always reads zero. m2dl1, m2dl0 ?mi bus delay select (refer to section 6) ? this bit is not present on early versions of the mc68hc711ph8. on those devices, bit 3 is not implemented and always reads zero, and the stretch function is controlled solely by the strch bit in opt2 (see section 3.3.2.5). contact your local motorola sales representative for further information. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom mapping (init2) $0037 ee3 ee2 ee1 ee0 strx ? 0 m2dl1 m2dl0 0000 0000 table 3-6 eeprom remapping ee[3:0] location ee[3:0] location 0000 $0d00e$0fff 1000 $8d00e$8fff 0001 $1d00e$1fff 1001 $9d00e$9fff 0010 $2d00e$2fff 1010 $ad00e$afff 0011 $3d00e$3fff 1011 $bd00e$bfff 0100 $4d00e$4fff 1100 $cd00e$cfff 0101 $5d00e$5fff 1101 $dd00e$dfff 0110 $6d00e$6fff 1110 $ed00e$efff 0111 $7d00e$7fff 1111 $fd00e$ffff tpg 60
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-17 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.3.2.4 option ?system con?uration options register 1 the 8-bit special-purpose option register sets internal system con?uration options during initialization. the time protected control bits irqe, dly, fcme and cr[1:0] can be written only once in the ?st 64 cycles after a reset and then they become read-only bits. this minimizes the possibility of any accidental changes to the system con?uration. they may be written at any time in special modes. adpu ?a/d power-up (refer to section 9) 1 (set) a/d system power enabled. 0 (clear) a/d system disabled, to reduce supply current. after enabling the a/d power, at least 100 m s should be allowed for system stabilization. csel ?clock select (refer to section 9) 1 (set) a/d, eprom and eeprom use internal rc clock source (about 1.5mhz). 0 (clear) a/d, eprom and eeprom use system e clock (must be at least 1mhz). this bit selects the clock source for the on-chip eprom , eeprom and a/d charge pumps. the on-chip rc clock should be used when the e clock frequency falls below 1mhz. irqe ?con?ure irq for falling edge sensitive operation 1 (set) falling edge sensitive operation. 0 (clear) low level sensitive operation. dly ?enable oscillator start-up delay 1 (set) a stabilization delay is imposed as the mcu is started up from stop mode (or from power-on reset). 0 (clear) the oscillator start-up delay is bypassed and the mcu resumes processing within about four bus cycles. a stable external oscillator is required if this option is selected. dly is set on reset, so a delay is always imposed as the mcu is started up from power-on reset. a mask option on the MC68HC11PH8 allows the selection of either a short or long delay time for power-on reset and exit from stop mode; either 128 or 4064 bus cycles. this option is not available on the mc68hc711ph8 where the delay time is 4064 bus cycles. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system contg. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 tpg 61
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-18 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 cme ?clock monitor enable (refer to section 10) 1 (set) clock monitor enabled. 0 (clear) clock monitor disabled. in order to use both stop and clock monitor, the cme bit should be set before executing stop, then set again after recovering from stop. fcme ?force clock monitor enable (refer to section 10) 1 (set) clock monitor enabled; cannot be disabled until next reset. 0 (clear) clock monitor follows the state of the cme bit. when fcme is set, slow or stopped clocks will cause a clock failure reset sequence. to utilize stop mode, fcme should always be cleared. cr[1:0] ?cop timer rate select bits (refer to section 10) these control bits determine a scaling factor for the watchdog timer. 3.3.2.5 opt2 ?system con?uration options register 2 lirdv ?lir driven 1 (set) enable lir push-pull drive. 0 (clear) lir not driven on moda/lir pin. this bit allows power savings in expanded modes by turning off the lir output (it has no meaning in single chip or bootstrap modes). the lir pin is driven low to indicate that execution of an instruction has begun. in order to detect consecutive instructions in a high speed application, this signal drives high for a quarter of a cycle to prevent false triggering. an external pull-up is required in expanded modes, while a hardwired vss connection is possible in single chip modes. lirdv is reset to zero in single chip modes, and to one in expanded modes. cwom ?port c wired-or mode (refer to section 4) 1 (set) port c outputs are open-drain. 0 (clear) port c operates normally. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system contg. options 2 (opt2) $0038 lirdv cwom strch irvne lsbf spr2 ext4x dise x00x 000t0 tpg 62
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-19 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 strch ?stretch external accesses 1 (set) off-chip accesses are selectively extended by one e clock cycle. 0 (clear) normal operation. when this bit is set, off-chip accesses of selected addresses are extended by one e clock cycle to allow access to slow peripherals. the e clock stretches externally, but the internal clocks are not affected, so that timers and serial systems are not corrupted. the state of the strx ? bit (in the init2 register) and the romad bit (in the config register) determines which address range is affected. see section 3.3.2.3. note: strch is cleared on reset; therefore a program cannot execute out of reset in a slow external rom. to use this feature, romon must be set on reset so that the device starts with internal rom included in the memory map. strch should then be set. setting strx means that all external accesses are stretched. if required (and allowed), romon can then be cleared so that internal rom is not present in the memory map (see section 3.4.3). if strx is cleared, then external accesses from $0000 to $1fff (romad set) or from $c000 to $dfff (romad cleared) are stretched. strch has no effect in single chip and boot modes. irvne ?internal read visibility/not e irvne can be written once in any user mode. in expanded modes , irvne determines whether irv is on or off (but has no meaning in user expanded secure mode, as irv must be disabled). in special test mode, irvne is reset to one. in normal modes, irvne is reset to zero. 1 (set) data from internal reads is driven out of the external data bus. 0 (clear) no visibility of internal reads on external bus. in single chip modes this bit determines whether the e clock drives out from the chip. 1 (set) e pin is driven low. 0 (clear) e clock is driven out from the chip. refer to the following table for a summary of the operation immediately following reset. ? the strx bit is not present on early versions of the mc68hc711ph8; on those devices, setting strch means that external accesses either from $0000 to $ffff or from $c000 to $dfff are stretched, depending on the state of romad. contact your local motorola sales representative for further information. tpg 63
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-20 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 lsbf ?lsb-?st enable (refer to section 7) 1 (set) data is transferred lsb ?st. 0 (clear) data is transferred msb ?st. spr2 ?spi clock rate select (refer to section 7) this bit adds a divide-by-four to the spi clock chain. ext4x ?4xlck or extal clock output select this bit can be written once and can be read at any time. 1 (set) extali clock output on the 4xout pin. 0 (clear) 4xclk clock output on the 4xout pin. this bit selects which clock is to be output on the 4xout pin, when enabled by the clk4x bit in config (see section 3.3.2.1). on reset, or when bcs = 0, 4xclk (the pll output) is the same as extali. refer to section 2-6. there is a phase delay between extali and 4xout. note: the 4xout pin is not available on 84-pin packaged devices. dise ?e clock output disable this bit can be written once and can be read at any time. 1 (set) no e clock output. 0 (clear) e clock is output normally. irvne allows e clock to be turned off in single chip modes. dise has been added for expanded modes, but can be used in every mode. writing a zero to this bit prevents accidental e clock turn-off in systems requiring this signal. mode irvne after reset e clock after reset irv after reset irvne affects only irvne can be written single chip 0 on off e once expanded 0 on off irv once boot 0 on off e unlimited special test 1 on on irv unlimited tpg 64
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-21 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.3.2.6 bprot ?block protect register bprot prevents accidental writes to eeprom and the config register. the bits in this register can be written to zero only once during the ?st 64 e clock cycles after reset in the normal modes; they can be set at any time. once the bits are cleared, the eeprom array and the config register can be programmed or erased. setting the bits in the bprot register to logic one protects the eeprom and config register until the next reset. refer to table 3-7. bulkp ?bulk erase of eeprom protect 1 (set) eeprom cannot be bulk or row erased. 0 (clear) eeprom can be bulk erased normally. bit 6 ?not implemented; always reads zero. bprt4 ?block protect bit for top 256 bytes of eeprom (see below) ptcon ?protect for config register 1 (set) config register cannot be programmed or erased. 0 (clear) config register can be programmed or erased normally. note that, in special modes, config may be written regardless of the state of ptcon. bprt[4:0] ?block protect bits for eeprom 1 (set) protection is enabled for associated block; it cannot be programmed or erased. 0 (clear) protection disabled for associated block. each of these ?e bits protects a block of eeprom against writing or erasure, as follows: address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset block protect (bprot) $0035 bulkp 0 bprt4 ptcon bprt3 bprt2 bprt1 bprt0 1011 1111 table 3-7 eeprom block protect bit name block protected block size bprt0 $xd00e$xd1f 32 bytes bprt1 $xd20e$xd5f 64 bytes bprt2 $xd60e$xddf 128 bytes bprt3 $xde0e$xeff 288 bytes bprt4 $xf00e$xfff 256 bytes tpg 65
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-22 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.3.2.7 tmsk2 ?timer interrupt mask register 2 pr[1:0] are time-protected control bits and can be changed only once and then only within the ?st 64 bus cycles after reset in normal modes. note: bits in tmsk2 correspond bit for bit with ?g bits in tflg2. ones in tmsk2 enable the corresponding interrupt sources. toi ?timer over?w interrupt enable (refer to section 8) 1 (set) interrupt requested when tof is set. 0 (clear) tof interrupts disabled. rtii ?real-time interrupt enable (refer to section 8) 1 (set) interrupt requested when rtif set. 0 (clear) rtif interrupts disabled. paovi ?pulse accumulator over?w interrupt enable (refer to section 8) 1 (set) interrupt requested when paovf set. 0 (clear) paovf interrupts disabled. paii ?pulse accumulator interrupt enable (refer to section 8) 1 (set) interrupt requested when paif set. 0 (clear) paif interrupts disabled. bits [3, 2] ?not implemented; always read zero. pr[1:0] ?timer prescaler select these two bits select the prescale rate for the main 16-bit free-running timer system. these bits can be written only once during the ?st 64 e clock cycles after reset in normal modes, or at any time in special modes. refer to the following table: address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 pr[1:0] prescale factor 0 0 1 0 1 4 1 0 8 1 1 16 tpg 66
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-23 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.4 eprom , eeprom and config register 3.4.1 eprom using the on-chip eprom programming feature requires an external power supply (v ppe ). normal programming is accomplished using the eprog register. program eprom at room temperature only and place an opaque label over the quartz window during and after programming. the csel bit in the option register selects an on-chip oscillator clock for programming the eprom while operating at frequencies below 1mhz. the erased state of each eprom byte is $ff. 3.4.1.1 eprog ?eprom programming control register mbe ?multiple byte program enable this bit may be read or written only in special modes; it will always read zero in normal modes. 1 (set) program 12 bytes with the same data. 0 (clear) normal programming. eprom is made up of three blocks of 16k bytes. when programming, address bits 4 and 7 are ignored, so that 4 addresses per block are programmed simultaneously. address bits 14 and 15 are also ignored so that a total of twelve addresses are written at once, four in each 16k byte block. for example, with the eprom mapped to $4000?fff, a write to $4026 will actually program $4026, $4036, $40a6, $40b6, $8026, $8036, $80a6, $80b6, $c026, $c036. $c0a6 and $c0b6 (i.e. %xx00 0000 x01x 0110). bits [6, 2, 1] ?not implemented; always read zero. elat ?eprom latch control elat may be read and written at any time. 1 (set) eprom address and data buses con?ured for programming. eprom cannot be read. 0 (clear) eprom address and data buses con?ured for normal operation. when set, this bit causes the address and data for writes to the eprom to be latched. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eprom programming (eprog) $002b mbe 0 elat excol exrow 0 0 epgm 0000 0000 tpg 67
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-24 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 excol ?select extra columns the excol bit always reads zero in normal modes and may be read or written only in special modes. 1 (set) user array disabled; extra column selected. 0 (clear) user array selected. the extra column may be accessed at bit 7; addresses use bits 15?, bits 4? must be ones. exrow ?select extra rows this bit always reads zero in normal modes and may be read or written only in special modes. 1 (set) user array disabled; extra rows selected. 0 (clear) user array selected. there are six extra rows (two in each block). addresses use bits 6?, bits 11? must be zeros. (the high nibble determines which 16k block is accessed.) epgm ?eprom program command this bit can be read at any time, but may only be written if elat is set. 1 (set) programming voltage (v ppe ) switched to the eprom array. 0 (clear) programming voltage (v ppe ) disconnected from the eprom array. note: if elat = 0 (normal operation) then epgm = 0 (programming voltage disconnected). 3.4.1.2 eprom programming the eprom may be programmed and veri?d in software, via the mcu, using the following procedure. the romon bit in the config register should be set. to use this method in special bootstrap mode, the external eprom programming voltage must be applied on pin vppe. on entry, a contains the data to be programmed and x contains the eprom address. eprog ldab #$20 stab $002b set elat bit (pgm=0) to enable eprom latches. staa $0, x store data to eprom address ldab #$21 stab $002b set epgm bit, with elat=1, to enable prog. voltage jsr dlyep delay teprog clr $002b turn off programming voltage and set to read mode user-developed software can be uploaded through the sci, or an eprom programming utility resident in the bootstrap rom can be used. to use the resident utility, bootload a three-byte program into ram consisting of a single jump instruction to $bf00 (the starting address of a tpg 68
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-25 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 resident eprom programming utility), along with instructions to set the x and y index registers to default values. the utility program receives programming data from an external host and puts it in eprom. the value in ix determines programming delay time; for example, at 4 mhz operation, a delay constant of 8000 in ix will give a 2ms delay time. the value in iy is a pointer to the ?st address in eprom to be programmed (normally = $4000). when the utility program is ready to receive programming data, it sends the host an $ff character; then it waits. when the host sees the $ff character, the eprom programming data is sent, starting with location $4000. after the last byte to be programmed is sent and the corresponding veri?ation data is returned, the programming operation is terminated by resetting the mcu. 3.4.2 eeprom the 768-byte on-board eeprom is initially located from $0d00 to $0fff after reset in all modes. it can be mapped to any other 4k page by writing to the init2 register. the eeprom is enabled by the eeon bit in the config register. programming and erasing are controlled by the pprog register. unlike information stored in rom, data in the 768 bytes of eeprom can be erased and reprogrammed under software control. because programming and erasing operations use an on-chip charge pump driven by v dd , a separate external power supply is not required. an internal charge pump supplies the programming voltage. use of the block protect register (bprot) prevents inadvertent writes to (or erases of) blocks of eeprom (see section 3.3.2.6). the csel bit in the option register selects an on-chip oscillator clock for programming and erasing the eeprom while operating at frequencies below 1mhz. in special modes there is one extra row of eeprom, which is used for factory testing. endurance and data retention speci?ations do not apply to these cells. the erased state of each eeprom byte is $ff. 3.4.2.1 pprog ?eeprom programming control register note: writes to eeprom addresses are inhibited while eepgm is one. a write to a different eeprom location is prevented while a program or erase operation is in progress. odd ?program odd rows in half of eeprom (test) even ?program even rows in half of eeprom (test) if both odd and even are set to one then all odd and even rows in half of the eeprom will be programmed with the same data, within one programming cycle. bit 5 ?not implemented; always reads zero. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom programming (pprog) $003b odd even 0 byte row erase eelat eepgm 0000 0000 tpg 69
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-26 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 byte ?eeprom byte erase mode 1 (set) erase only one byte of eeprom. 0 (clear) row or bulk erase mode used. this bit may be read or written at any time. row ?eeprom row/bulk erase mode (only valid when byte = 0) 1 (set) erase only one 16 byte row of eeprom. 0 (clear) erase all 768 bytes of eeprom. this byte can be read or written at any time. erase ?erase/normal control for eeprom 1 (set) erase mode. 0 (clear) normal read or program mode. this byte can be read or written at any time. eelat ?eeprom latch control 1 (set) eeprom address and data bus set up for programming or erasing. 0 (clear) eeprom address and data bus set up for normal reads. when the eelat bit is cleared, the eeprom can be read as if it were a rom. the block protect register has no effect during reads. this bit can be read and written at any time. eepgm ?eeprom program command 1 (set) program or erase voltage switched on to eeprom array. 0 (clear) program or erase voltage switched off to eeprom array. this bit can be read at any time but can only be written if eelat = 1. note: if eelat = 0 (normal operation) then eepgm = 0 (programming voltage disconnected). table 3-8 erase mode selection byte row action 0 0 bulk erase (all 768 bytes) 0 1 row erase (16 bytes) 1 0 byte erase 1 1 byte erase tpg 70
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-27 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 during eeprom programming, the row and byte bits of pprog are not used. if the frequency of the e clock is 1mhz or less, set the csel bit in the option register. remember that the eeprom must be erased by a separate erase operation before programming. the following example of how to program an eeprom byte assumes that the appropriate bits in bprot have been cleared. prog ldab #$02 eelat=1 stab $003b set eelat bit staa $0d00 store data to eeprom address ldab #$03 eelat=eepgm=1 stab $003b turn on programming voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode 3.4.2.2 eeprom bulk erase to erase the eeprom, ensure that the proper bits of the bprot register are cleared, then complete the following steps using the pprog register: 1) write to pprog with the erase, eelat and appropriate byte and row bits set. 2) write to the appropriate eeprom address with any data. row erase only requires a write to any location in the row. bulk erase is accomplished by writing to any location in the array. 3) write to pprog with erase, eelat, eepgm and the appropriate byte and row bits set. 4) delay for time t eeprog (see section a.5.6). 5) clear the eepgm bit in pprog to turn off the high voltage. 6) clear the pprog register to recon?ure the eeprom address and data buses for normal operation. the following is an example of how to bulk erase the 768-byte eeprom. the config register is not affected in this example. bulke ldab #$06 eelat=erase=1 stab $003b set eelat bit staa $0d00 store data to any eeprom address ldab #$07 eelat=erase=eepgm=1 stab $003b turn on programming voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode tpg 71
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-28 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.4.2.3 eeprom row erase the following example shows how to perform a fast erase of 16 bytes of eeprom: rowe ldab #$0e row=erase=eelat=1 stab $003b set to row erase mode stab 0,x write any data to any address in row ldab #$0f row=erase=eelat=eepgm=1 stab $003b turn on high voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode 3.4.2.4 eeprom byte erase the following is an example of how to erase a single byte of eeprom: bytee ldab #$16 byte=erase=eelat=1 stab $003b set to byte erase mode stab 0,x write any data to address to be erased ldab #$17 byte=erase=eelat=eepgm=1 stab $003b turn on high voltage jsr dly10 delay teeprog clr $003b turn off high voltage and set to read mode tpg 72
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-29 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.4.3 config register programming because the config register is implemented with eeprom cells, use eeprom procedures to erase and program this register. the procedure for programming is the same as for programming a byte in the eeprom array, except that the config register address is used. config can be programmed or erased (including byte erase) while the mcu is operating in any mode, provided that ptcon in bprot is clear. to change the value in the config register, complete the following procedure. do not initiate a reset until the procedure is complete. 1) erase the config register. 2) program the new value to the config address. 3) initiate reset. config ?system con?uration register for a description of the bits contained in the config register refer to section 3.3.2.1. config is made up of eeprom cells and static working latches. the operation of the mcu is controlled directly by these latches and not the eeprom byte. when programming the config register, the eeprom byte is accessed. when the config register is read, the static latches are accessed. these bits can be read at any time. the value read is the one latched into the register from the eeprom cells during the last reset sequence. a new value programmed into this register is not readable until after a subsequent reset sequence. on the mc68hc711ph8 , and on the MC68HC11PH8 if selected by a mask option, the romon bit can be written at any time if mda = 1 (expanded mode or special test mode). it cannot be written in bootstrap mode, and is forced to a logic one in single chip mode. other bits in config can be written at any time if smod = 1 (bootstrap or special test mode). if smod = 0 (single chip or expanded mode), these bits can only be written using the eeprom programming sequence, and none of the bits is readable or active until latched via the next reset. freez is only active in expanded user mode. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset contguration control (config) $003f romad freez clk4x paren nosec nocop romon eeon xxxx xxxx tpg 73
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-30 MC68HC11PH8 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 3.4.4 ram and eeprom security the optional security feature protects the contents of eeprom and ram from unauthorized access. data, codes, keys, a program, or a key portion of a program, can be protected against access. to accomplish this, the protection mechanism prevents operation of the device in special test mode. only resident programs have unlimited access to the internal eeprom and ram and can read, write, or transfer the contents of these memories. to maintain ram and eeprom security, the following conditions should be satis?d: the internal rom must be enabled and mapped at $4000?ffff, by setting the romon and romad bits in the config register. this means that program execution starts after reset under control of the internal rom (see section 3.3.2.1). access to external addresses should be restricted to data read or write. program execution should not point from the internal resources to the external memory map. the freez bit in the config register may be set to prevent internal address visibility on the ports (see section 3.3.2.1). alternatively, eeprom-only security is possible: in expanded mode, program execution is possible in external resources, but the eeprom read or write access is restricted by internal hardware; instructions must be executed from internal rom/ eprom in the range $4000 to $43ff (with romad set) or in the range $0000 to $03ff (with romad clear). avoid using indexed addressing in this rom/ eprom range, and clear temporary copies of eeprom data before returning to the main program. as above, the freez bit in the config register may be set to prevent internal address visibility on the ports (see section 3.3.2.1). note: a mask option on the MC68HC11PH8 determines whether or not the security feature is available (it is always available on the mc68hc711ph8) . if the feature is available, then the secure mode can be invoked by programming the nosec bit to zero. otherwise, the nosec bit is permanently set to one, disabling security. tpg 74
ph8.ds03/modes+mem ?his line does not form part of the document [ds97 v 4.1] 08/apr/97@13:55 MC68HC11PH8 motorola 3-31 operating modes and on-chip memory 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 if the security feature is present and enabled and bootstrap mode is selected, then the following sequence is performed by the bootstrap program: 1) output $ff on the sci. 2) turn block protect off. clear bprot register. 3) if eeprom is enabled, erase it all. 4) verify that the eeprom is erased; if not, begin sequence again. 5) write $ff to every ram byte. 6) erase the config register. if all the above operations are successful, the bootloading process continues as if the device has not been secured. config ?system con?uration register for a description of the other bits contained in the config register refer to section 3.3.2.1. nosec ?eeprom security disabled 1 (set) disable security. 0 (clear) enable security. with security enabled, selection of special test mode is prevented; single chip and user expanded modes may be accessed. if the moda and modb pins are con?ured for special test mode, the part will start in bootstrap mode. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset contguration control (config) $003f romad freez clk4x paren nosec nocop romon eeon xxxx xxxx tpg 75
08/apr/97@13:55 [ds97 v 4.1] ?his line does not form part of the document ph8.ds03/modes+mem motorola 3-32 MC68HC11PH8 operating modes and on-chip memory this page intentionally left blank 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 tpg 76
MC68HC11PH8 motorola 4-1 parallel input/output 4 4 parallel input/output the MC68HC11PH8 has up to 54 input/output lines and 8 input-only lines, depending on the operating mode. to enhance the i/o functions, the data bus of this microcontroller is non-multiplexed. the following table is a summary of the con?uration and features of each port. note: do not confuse pin function with the electrical state of that pin at reset. all general-purpose i/o pins that are con?ured as inputs at reset are in a high-impedance state and the contents of the port data registers are unde?ed; in port descriptions, a ? indicates this condition. the pin function is mode dependent. table 4-1 port con?uration port input pins output pins bidirectional pins alternate functions a ? ? 8 timer b ? ? 8 high order address and lcd segment drivers c ? ? 8 data bus d ? ? 6 spi1 and sci1 e 8 ? ? a/d converter f ? ? 8 low order address g ? ? 8 r/w on pg7, lcdbp on pg6, spi2 and sci2 (with mi bus) h ? ? 8 pwm and modulus timer clock inputs, keyboard interrupt tpg 77
motorola 4-2 MC68HC11PH8 parallel input/output 4 4.1 port a port a is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port a pins are shared with timer functions, as shown in the following table. on reset the pins are con?ured as general purpose high-impedance inputs. 4.1.1 porta ?port a data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. 4.1.2 ddra ?data direction register for port a dda[7:0] ?data direction for port a 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function pa0 ic3 pa1 ic2 pa2 ic1 pa3 oc5 and/or oc1, or ic4 pa4 oc4 and/or oc1 pa5 oc3 and/or oc1 pa6 oc2 and/or oc1 pa7 pai and/or oc1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port a data (porta) $0000 pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction a (ddra) $0001 dda7 dda6 dda5 dda4 dda3 dda2 dda1 dda0 0000 0000 ? ? see section 8 for more information. tpg 78
MC68HC11PH8 motorola 4-3 parallel input/output 4 4.2 port b port b is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port b pins are used as the non-multiplexed high order address pins, as shown in the following table. the state of the pins on reset is mode dependent. in single chip or bootstrap mode, port b pins are high-impedance inputs with selectable internal pull-up resistors (see section 4.9). in expanded or test mode, port b pins are high order address outputs and portb/ddrb are not in the memory map. alternatively, four lcd segment drivers can be enabled, in all modes, on pb4?b7 (see section 2.12). 4.2.1 portb ?port b data register the bits may be read and written at any time and are not affected by reset. 4.2.2 ddrb ?data direction register for port b ddb[7:0] ?data direction for port b 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function pb0 a8 pb1 a9 pb2 a10 pb3 a11 pb4 a12/lcd4 pb5 a13/lcd5 pb6 a14/ lcd6 pb7 a15/lcd7 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port b data (portb) $0004 pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction b (ddrb) $0002 ddb7 ddb6 ddb5 ddb4 ddb3 ddb2 ddb1 ddb0 0000 0000 ? ? in expanded or test mode, the pins become the high order address lines and port b is not included in the memory map. tpg 79
motorola 4-4 MC68HC11PH8 parallel input/output 4 4.3 port c port c is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port c pins are used as the non-multiplexed data bus pins, as shown in the following table. the state of the pins on reset is mode dependent. in single chip or bootstrap mode, port c pins are high-impedance inputs. in expanded or test modes, port c pins are the data bus i/o and portc/ddrc are not in the memory map. 4.3.1 portc ?port c data register the bits may be read and written at any time and are not affected by reset. 4.3.2 ddrc ?data direction register for port c ddc[7:0] ?data direction for port c 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function pc0 d0 pc1 d1 pc2 d2 pc3 d3 pc4 d4 pc5 d5 pc6 d6 pc7 d7 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port c data (portc) $0006 pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction c (ddrc) $0007 ddc7 ddc6 ddc5 ddc4 ddc3 ddc2 ddc1 ddc0 0000 0000 ? ? in expanded or test mode, the pins become the data bus and port c is not included in the memory map. tpg 80
MC68HC11PH8 motorola 4-5 parallel input/output 4 4.4 port d port d is a 6-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port d pins are shared with sci1 and spi1 functions, as shown in the following table. on reset the pins are con?ured as general purpose high-impedance inputs. 4.4.1 portd ?port d data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. 4.4.2 ddrd ?data direction register for port d bits [7:6] ?reserved; always read zero ddd[5:0] ?data direction for port d 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function pd0 rxd1 pd1 txd1 pd2 miso1 pd3 mosi1 pd4 sck1 pd5 ss1 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port d data (portd) $0008 0 0 pd5 pd4 pd3 pd2 pd1 pd0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction d (ddrd) $0009 0 0 ddd5 ddd4 ddd3 ddd2 ddd1 ddd0 0000 0000 see section 7 for more information. see section 5 for more information. ? ? ? ? tpg 81
motorola 4-6 MC68HC11PH8 parallel input/output 4 4.5 port e port e is an 8-bit input-only port. in addition to their input capability, port e pins are shared with a/d functions, as shown in the following table. on reset the pins are con?ured as general purpose high-impedance inputs. 4.5.1 porte ?port e data register this is a read-only register and is not affected by reset. the bits may be read at any time. note: as port e shares pins with the a/d converter, a read of this register may affect any conversion currently in progress, if it coincides with the sample portion of the conversion cycle. hence, normally port e should not be read during the sample portion of any conversion. pin alternate function pe0 ad0 pe1 ad1 pe2 ad2 pe3 ad3 pe4 ad4 pe5 ad5 pe6 ad6 pe7 ad7 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port e data (porte) $000a pe7 pe6 pe5 pe4 pe3 pe2 pe1 pe0 undetned ? ? see section 9 for more information. tpg 82
MC68HC11PH8 motorola 4-7 parallel input/output 4 4.6 port f port f is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port f pins are used as the non-multiplexed low order address pins, as shown in the following table. the state of the pins on reset is mode dependent. in single chip or bootstrap mode, port f pins are high-impedance inputs with selectable internal pull-up resistors (see section 4.9). in expanded or test modes, port f pins are low order address outputs and portf/ddrf are not in the memory map. 4.6.1 portf ?port f data register the bits may be read and written at any time and are not affected by reset. 4.6.2 ddrf ?data direction register for port f ddf[7:0] ?data direction for port f 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function pf0 a0 pf1 a1 pf2 a2 pf3 a3 pf4 a4 pf5 a5 pf6 a6 pf7 a7 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port f data (portf) $0005 pf7 pf6 pf5 pf4 pf3 pf2 pf1 pf0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction f (ddrf) $0003 ddf7 ddf6 ddf5 ddf4 ddf3 ddf2 ddf1 ddf0 0000 0000 ? ? in expanded or test mode, the pins become the low order address and port f is not included in the memory map. tpg 83
motorola 4-8 MC68HC11PH8 parallel input/output 4 4.7 port g port g is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port g pins are shared with r/w , lcd, sci2 (with mi-bus) and spi2 functions, as shown in the following table. pins pg[6:0] are high-impedance inputs with software selectable pull-up resistors, as is pg7 in single chip and bootstrap modes (see section 4.9). in expanded or test modes, pg7 is the r/w output. 4.7.1 portg ?port g data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but, when a pin is allocated to its alternate function, a write to the corresponding register bit has no effect on the pin state. 4.7.2 ddrg ?data direction register for port g ddg[7:0] ?data direction for port g 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function pg0 rxd2 pg1 txd2 pg2 miso2 pg3 mosi2 pg4 sck2 pg5 ss2 pg6 lcdbp pg7 r/w address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port g data (portg) $007e pg7 pg6 pg5 pg4 pg3 pg2 pg1 pg0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction g (ddrg) $007f ddg7 ddg6 ddg5 ddg4 ddg3 ddg2 ddg1 ddg0 0000 0000 see section 7 for more information. ? ? ? ? see section 5 for more information. ? ? see section 2 for more information. tpg 84
MC68HC11PH8 motorola 4-9 parallel input/output 4 4.8 port h port h is an 8-bit bidirectional port, with both data and data direction registers. in addition to their i/o capability, port h pins are shared with modulus timer and pwm functions, as shown in the following table. each port h pin con?ured as an input can be used as a keyboard interrupt, if enabled (see section 4.8.3). on reset the pins are con?ured as general purpose high-impedance inputs with selectable internal pull-ups (see section 4.9). 4.8.1 porth ?port h data register this is a read/write register and is not affected by reset. the bits may be read and written at any time, but when one of the pins ph[3:0] is allocated to its alternate function of pwm channel, a write to the corresponding register bit has no affect on the pin state. 4.8.2 ddrh ?data direction register for port h ddh[7:0] ?data direction for port h 1 (set) the corresponding pin is con?ured as an output. 0 (clear) the corresponding pin is con?ured as an input. pin alternate function ph0 pw1 ph1 pw2 ph2 pw3 ph3 pw4 ph4 ? ph5 ? ph6 modulus timer c clock input ph7 modulus timer b clock input address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port h data (porth) $007c ph7 ph6 ph5 ph4 ph3 ph2 ph1 ph0 undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset data direction h (ddrh) $007d ddh7 ddh6 ddh5 ddh4 ddh3 ddh2 ddh1 ddh0 0000 0000 see section 8 for more information. ? ? tpg 85
motorola 4-10 MC68HC11PH8 parallel input/output 4 4.8.3 wired-or interrupt 4.8.3.1 woieh ?woi enable (woieh) iehx ?port h pin x wired-or interrupt enable 1 (set) phx wired-or interrupt enabled. 0 (clear) phx wired-or interrupt disabled. with the wired-or interrupt function enabled, any port h pin con?ured as an input may be used as a keyboard interrupt. a high to low transition on an enabled pin (with all other enabled pins high) will result in an interrupt. the wired-or interrupt ?g (bit 4 of the port pull-up assignment register) indicates that an interrupt has occurred (see section 4.9.1). a wired-or interrupt can wake the mcu from stop or wait mode. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset wired-or interrupt enable (woieh) $007b ieh7 ieh6 ieh5 ieh4 ieh3 ieh2 ieh1 ieh0 0000 0000 tpg 86
MC68HC11PH8 motorola 4-11 parallel input/output 4 4.9 internal pull-up resistors four of the ports (b, f, g and h) have internal, software selectable pull-up resistors under control of the port pull-up assignment register (ppar). 4.9.1 ppar ?port pull-up assignment register bits [7:5] ?not implemented; always read zero. hwoif ?port h wired-or interrupt ?g 1 (set) port h keyboard interrupt request. 0 (clear) no port h keyboard interrupt request. this bit is cleared by a write to the ppar register with hwoif set . when this function is used, care must be taken when changing pull-up enable bits to prevent accidental clearing of this ?g. xppue ?port x pin pull-up enable these bits control the on-chip pull-up devices connected to all the pins on i/o ports b, f, g and h. they are collectively enabled or disabled via the paren bit in the config register (see section 4.10.2). 1 (set) port x pin on-chip pull-up devices enabled. 0 (clear) port x pin on-chip pull-up devices disabled. note: fppue and bppue have no effect in expanded mode since ports f and b are dedicated address bus or lcd outputs. note: when the sci2 receiver is enabled, the associated pull-up on port g is disabled. 4.10 system con?uration one bit in each of the following registers is directly concerned with the con?uration of the i/o ports. for full details on the other bits in the registers, refer to the appropriate section. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset port pull-up assignment (ppar) $002c 0 0 0 hwoif hppue gppue fppue bppue 0000 1111 tpg 87
motorola 4-12 MC68HC11PH8 parallel input/output 4 4.10.1 opt2 ?system con?uration options register 2 lirdv ?lir driven (refer to section 3) 1 (set) enable lir push-pull drive. 0 (clear) lir not driven on moda/lir pin. cwom ?port c wired-or mode 1 (set) port c outputs are open-drain. 0 (clear) port c operates normally. strch ?stretch external accesses (refer to section 3) 1 (set) off-chip accesses are extended by one e clock cycle. 0 (clear) normal operation. irvne ?internal read visibility/not e (refer to section 3) 1 (set) data from internal reads is driven out of the external data bus. 0 (clear) no visibility of internal reads on external bus. in single chip mode this bit determines whether the e clock drives out from the chip. 1 (set) e pin is driven low. 0 (clear) e clock is driven out from the chip. lsbf ?lsb ?st enable (refer to section 7) 1 (set) spi1 data is transferred lsb ?st. 0 (clear) spi1 data is transferred msb ?st. spr2 ?spi1 clock rate select (refer to section 7) ext4x ?4xlck or extal clock output select (refer to section 3 1 (set) extali clock output on the 4xout pin. 0 (clear) 4xclk clock output on the 4xout pin. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system contg. options 2 (opt2) $0038 lirdv cwom strch irvne lsbf spr2 ext4x dise x00x 0000 tpg 88
MC68HC11PH8 motorola 4-13 parallel input/output 4 dise?e clock output disable (refer to section 3) 1 (set) no e clock output. 0 (clear) e clock is output normally. 4.10.2 config ?system con?uration register romad ?rom/ eprom mapping control (refer to section 3) 1 (set) rom/ eprom addressed from $4000 to $ffff. 0 (clear) rom/ eprom addressed from $0000 to $bfff (expanded mode only). freez ?expanded user mode address bus freeze (refer to section 3) 1 (set) the external bus is only active when externally mapped resources are accessed (expanded mode only). 0 (clear) normal operation. clk4x ?4x clock enable (refer to section 3) 1 (set) 4xclk or extali driven out on the 4xout pin. 0 (clear) 4xout pin disabled. paren ?pull-up assignment register enable 1 (set) pull-ups can be enabled using ppar register. 0 (clear) all pull-ups disabled. nosec ?eeprom security disabled (refer to section 3) 1 (set) disable security. 0 (clear) enable security. nocop ?cop system disable (refer to section 10) 1 (set) cop system disabled. 0 (clear) cop system enabled (forces reset on timeout). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset contguration control (config) $003f romad freez clk4x paren nosec nocop romon eeon xxxx xxxx tpg 89
motorola 4-14 MC68HC11PH8 parallel input/output 4 romon ?rom/ eprom enable (refer to section 3) 1 (set) rom/ eprom present in the memory map. 0 (clear) rom/ eprom disabled from the memory map. eeon ?eeprom enable (refer to section 3) 1 (set) eeprom is present in the memory map. 0 (clear) eeprom is disabled from the memory map. tpg 90
MC68HC11PH8 motorola 5-1 serial communications interface 5 5 serial communications interface ? the serial communications interface (sci) is a universal asynchronous receiver transmitter (uart). it has a non-return to zero (nrz) format (one start, eight or nine data, and one stop bit) that is compatible with standard rs-232 systems. the sci shares i/o with two of port ds pins: the sci transmit and receive functions are enabled by te and re respectively, in sccr2. the sci features enabled on this mcu include: 13-bit modulus prescaler, idle line detect, receiver-active ?g, transmitter and receiver hardware parity. a block diagram of the enhanced baud rate generator is shown in figure 5-1. see table 5-1 for example baud rate control values. ? the MC68HC11PH8 contains two serial communications interfaces, both having similar operation. for ease of reference, a full description of sci1 (pd0/rxd1, pd1/txd1) is given ?st, followed by a summary of sci2 (section 5.8), detailing its differences. pin alternate function pd0 rxd1 pd1 txd1 figure 5-1 sci baud rate generator circuit diagram 13-bit compare sync scbdh/l : sci baud control 13-bit counter ? 2 internal phase 2 clock receiver baud rate clock ? 16 transmitter baud rate clock st4xck reset eq tpg 91
motorola 5-2 MC68HC11PH8 serial communications interface 5 5.1 data format the serial data format requires the following conditions: an idle-line condition before transmission or reception of a message. a start bit, logic zero, transmitted or received, that indicates the start of each character. data that is transmitted and received least signi?ant bit (lsb) ?st. a stop bit, logic one, used to indicate the end of a frame. (a frame consists of a start bit, a character of eight or nine data bits, and a stop bit.) a break (de?ed as the transmission or reception of a logic zero for some multiple number of frames). selection of the word length is controlled by the m bit of sccr1. 5.2 transmit operation the sci transmitter includes a parallel data register (scdrh/scdrl) and a serial shift register. the contents of the shift register can only be written through the parallel data register. this double buffered operation allows a character to be shifted out serially while another character is waiting in the parallel data register to be transferred into the shift register. the output of the shift register is applied to txd as long as transmission is in progress or the transmit enable (te) bit of serial communication control register 2 (sccr2) is set. the block diagram, figure 5-2, shows the transmit serial shift register and the buffer logic at the top of the ?ure. 5.3 receive operation during receive operations, the transmit sequence is reversed. the serial shift register receives data and transfers it to the parallel receive data registers (scdrh/scdrl) as a complete word. this double buffered operation allows a character to be shifted in serially while another character is still in the serial data registers. an advanced data recovery scheme distinguishes valid data from noise in the serial data stream. the data input is selectively sampled to detect receive data, and majority sampling logic determines the value and integrity of each bit. tpg 92
MC68HC11PH8 motorola 5-3 serial communications interface 5 figure 5-2 sci1 block diagram loops woms wake + & & & & & ? m ilt pe pt sccr1 10/11-bit tx shift register h8 l 0 7 10/11-bit rx shift register 80 7 tie tcie te rie ilie re rwu sbk sccr2 tdre tc or rdrf idle nf fe pf scsr1 raf scsr2 data recovery rxd1 txd1 scdrh/scdrl (receive buffer) r8 scdrh/scdrl (transmit buffer) t8 transmitter control receiver control loops sci interrupt request woms woms m pe pt te sbk wake pe pt re rwu m loops ilt stop start scbdl scbdh rate generator st4xck or rie rie idle ilie rdrf tc tcie tdre tie note: ? = always reads as zero flag control internal data bus clock tpg 93
motorola 5-4 MC68HC11PH8 serial communications interface 5 5.4 wake-up feature the wake-up feature reduces sci service overhead in multiple receiver systems. software for each receiver evaluates the ?st character or frame of each message. all receivers are placed in wake-up mode by writing a one to the rwu bit in the sccr2 register. when rwu is set, the receiver-related status ?gs (rdrf, idle, or, nf, fe, and pf) are inhibited (cannot be set). although rwu can be cleared by a software write to sccr2, to do so would be unusual. normally rwu is set by software and is cleared automatically with hardware. whenever a new message begins, logic alerts the dormant receivers to wake up and evaluate the initial character of the new message. two methods of wake-up are available: idle-line wake-up and address mark wake-up. during idle-line wake-up, a dormant receiver activates as soon as the rxd line becomes idle. in the address mark wake-up, logic one in the most signi?ant bit (msb) of a character activates all sleeping receivers. to use either receiver wake-up method, establish a software addressing scheme to allow the transmitting devices to direct messages to individual receivers or to groups of receivers. this addressing scheme can take any form as long as all transmitting and receiving devices are programmed to understand the same scheme. 5.4.1 idle-line wake-up clearing the wake bit in sccr1 register enables idle-line wake-up mode. in idle-line wake-up mode, all receivers are active (rwu bit in sccr2 = 0) when each message begins. the ?st frames of each message are addressing frames. each receiver in the system evaluates the addressing frames of a message to determine if the message is intended for that receiver. when a receiver ?ds that the message is not intended for it, it sets the rwu bit. once set, the rwu control bit disables all but the necessary receivers for the remainder of the message, thus reducing software overhead for the remainder of that message. as soon as an idle line is detected by receiver logic, hardware automatically clears the rwu bit so that the ?st frames of the next message can be evaluated by all receivers in the system. this type of receiver wake-up requires a minimum of one idle frame time between messages, and no idle time between frames within a message. 5.4.2 address-mark wake-up setting the wake bit in sccr1 register enables address-mark wake-up mode. the address-mark wake-up method uses the msb of each frame to differentiate between address information (msb = 1) and actual message data (msb = 0). all frames consist of seven information bits (eight bits if m bit in sccr1 = 1) and an msb which, when set to one, indicates an address frame. the ?st frames of each message are addressing frames. receiver logic evaluates these marked frames to determine the receivers for which that message is intended. when a receiver ?ds that the message is not intended for it, it sets the rwu bit. once set, the rwu control bit disables all but the necessary receivers for the remainder of the message, thus reducing software overhead tpg 94
MC68HC11PH8 motorola 5-5 serial communications interface 5 for the remainder of that message. when the next message begins, its ?st frame will have the msb set which will automatically clear the rwu bit and indicate that this is an addressing frame. this frame is always the ?st frame received after wake-up because the rwu bit is cleared before the stop bit for the ?st frame is received. this method of wake-up allows messages to include idle times, however, there is a loss in ef?iency due to the extra bit time required for the address bit in each frame. 5.5 sci error detection four error conditions can occur during sci operation. these error conditions are: serial data register overrun, received bit noise, framing, and parity error. four bits (or, nf, fe, and pf) in serial communications status register 1 (scsr1) indicate if one of these error conditions exists. the overrun error (or) bit is set when the next byte is ready to be transferred from the receive shift register to the serial data registers (scdrh/scdrl) and the registers are already full (rdrf bit is set). when an overrun error occurs, the data that caused the overrun is lost and the data that was already in serial data registers is not disturbed. the or is cleared when the scsr is read (with or set), followed by a read of the sci data registers. the noise ?g (nf) bit is set if there is noise on any of the received bits, including the start and stop bits. the nf bit is not set until the rdrf ?g is set. the nf bit is cleared when the scsr is read (with fe equal to one) followed by a read of the sci data registers. when no stop bit is detected in the received data character, the framing error (fe) bit is set. fe is set at the same time as the rdrf. if the byte received causes both framing and overrun errors, the processor only recognizes the overrun error. the framing error ?g inhibits further transfer of data into the sci data registers until it is cleared. the fe bit is cleared when the scsr is read (with fe equal to one) followed by a read of the sci data registers. the parity error ?g (pf) is set if received data has incorrect parity. the ?g is cleared by a read of scsr1 with pe set, followed by a read of scdr. 5.6 sci registers there are eight addressable registers in the sci. scbdh, scbdl, sccr1, and sccr2 are control registers. the contents of these registers control functions and indicate conditions within the sci. the status registers scsr1 and scsr2 contain bits that indicate certain conditions within the sci. scdrh and scdrl are sci data registers. these double buffered registers are used for the transmission and reception of data, and are used to form the 9-bit data word for the sci. if the sci is being used with 7 or 8-bit data, only scdrl needs to be accessed. note that if 9-bit data format is used, the upper register should be written ?st to ensure that it is transferred to the transmitter shift register with the lower register. tpg 95
motorola 5-6 MC68HC11PH8 serial communications interface 5 5.6.1 scbdh, scbdl ?sci baud rate control registers the contents of this register determine the baud rate of the sci. btst ?baud register test (test mode only) bspl ?baud rate counter split (test mode only) brst ?baud rate reset (test mode only) sbr[12:0] ?sci baud rate selects use the following formula to calculate sci baud rate. refer to the table of baud rate control values for example rates: where the baud rate control value (br) is the contents of scbdh/l (br = 1, 2, 3,... 8191). for example, to obtain a baud rate of 1200 with a st4xck frequency of 12mhz, the baud register (scbdh/l) should contain $0138 (see table 5-1). the clock rate generator is disabled if br = 0, or if neither the receiver nor transmitter is enabled (both re and te in sccr2 are cleared). writes to the baud rate registers will only be successful if the last (or only) byte written is scbdl. the use of an std instruction is recommended as it guarantees that the bytes are written in the correct order. note: st4xck may be the output of the pll circuit or it may be the extal input of the mcu (see section 2.5, figure 8-1 and figure 8-2). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci1 baud rate high (scbdh) $0070 btst bspl brst sbr12 sbr11 sbr10 sbr9 sbr8 0000 0000 sci1 baud rate low (scbdl) $0071 sbr7 sbr6 sbr5 sbr4 sbr3 sbr2 sbr1 sbr0 0000 0100 sci baud rate st 4 xck 16 2 br () ---------------------------- - = tpg 96
MC68HC11PH8 motorola 5-7 serial communications interface 5 5.6.2 sccr1 ?sci control register 1 the sccr1 register provides the control bits that determine word length and select the method used for the wake-up feature. loops ?sci loop mode enable 1 (set) sci transmit and receive are disconnected from txd and rxd pins, and transmitter output is fed back into the receiver input. 0 (clear) sci transmit and receive operate normally. both the transmitter and receiver must be enabled to use the loop mode. when the loop mode is enabled, the txd pin is driven high (idle line state) if the transmitter is enabled. woms ?wired-or mode for sci pins (pd1, pd0) 1 (set) txd and rxd are open drains if operating as outputs. 0 (clear) txd and rxd operate normally. bit 5 ?not implemented; always reads zero table 5-1 example sci baud rate control values target baud rate st4xck frequency 8 mhz 12 mhz 16 mhz dec value hex value dec value hex value dec value hex value 110 2272 $08e0 3409 $0d51 4545 $11c1 150 1666 $0682 2500 $09c4 3333 $0d05 300 833 $0341 1250 $04e2 1666 $0682 600 416 $01a0 625 $0271 833 $0341 1200 208 $00d0 312 $0138 416 $01a0 2400 104 $0068 156 $009c 208 $00d0 4800 52 $0034 78 $004e 104 $0068 9600 26 $001a 39 $0027 52 $0034 19200 13 $000d 20 $0014 26 $001a 38400 13 $000d address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci1 control 1 (sccr1) $0072 loops woms 0 m wake ilt pe pt 0000 0000 tpg 97
motorola 5-8 MC68HC11PH8 serial communications interface 5 m ?mode (select character format) 1 (set) start bit, 9 data bits, 1 stop bit. 0 (clear) start bit, 8 data bits, 1 stop bit. wake ?wake-up by address mark/idle 1 (set) wake-up by address mark (most signi?ant data bit set). 0 (clear) wake-up by idle line recognition. ilt ?idle line type 1 (set) long (sci counts ones only after stop bit). 0 (clear) short (sci counts consecutive ones after start bit). this bit determines which of two types of idle line detection method is used by the sci receiver. in short mode the stop bit and any bits that were ones before the stop bit will be considered as part of that string of ones, possibly resulting in erroneous or premature detection of an idle line condition. in long mode the sci system does not begin counting ones until a stop bit is received. pe ?parity enable 1 (set) parity enabled. 0 (clear) parity disabled. pt ?parity type 1 (set) parity odd (an odd number of ones causes parity bit to be zero, an even number of ones causes parity bit to be one). 0 (clear) parity even (an even number of ones causes parity bit to be zero, an odd number of ones causes parity bit to be one). tpg 98
MC68HC11PH8 motorola 5-9 serial communications interface 5 5.6.3 sccr2 ?sci control register 2 the sccr2 register provides the control bits that enable or disable individual sci functions. tie ?transmit interrupt enable 1 (set) sci interrupt requested when tdre status ?g is set. 0 (clear) tdre interrupts disabled. tcie ?transmit complete interrupt enable 1 (set) sci interrupt requested when tc status ?g is set. 0 (clear) tc interrupts disabled. rie ?receiver interrupt enable 1 (set) sci interrupt requested when rdrf ?g or the or status ?g is set. 0 (clear) rdrf and or interrupts disabled. ilie ?idle line interrupt enable 1 (set) sci interrupt requested when idle status ?g is set. 0 (clear) idle interrupts disabled. te ?transmitter enable 1 (set) transmitter enabled. 0 (clear) transmitter disabled. re ?receiver enable 1 (set) receiver enabled. 0 (clear) receiver disabled. rwu ?receiver wake-up control 1 (set) wake-up enabled and receiver interrupts inhibited. 0 (clear) normal sci receiver. sbk ?send break 1 (set) break codes generated as long as sbk is set. 0 (clear) break generator off. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci1 control 2 (sccr2) $0073 tie tcie rie ilie te re rwu sbk 0000 0000 tpg 99
motorola 5-10 MC68HC11PH8 serial communications interface 5 5.6.4 scsr1 ?sci status register 1 the bits in scsr1 indicate certain conditions in the sci hardware and are automatically cleared by special acknowledge sequences. tdre ?transmit data register empty ?g 1 (set) scdr empty. 0 (clear) scdr busy. this ?g is set when scdr is empty. clear the tdre ?g by reading scsr1 with tdre set and then writing to scdr. tc ?transmit complete ?g 1 (set) transmitter idle. 0 (clear) transmitter busy. this ?g is set when the transmitter is idle (no data, preamble, or break transmission in progress). clear the tc ?g by reading scsr1 with tc set and then writing to scdr. rdrf ?receive data register full ?g 1 (set) scdr full. 0 (clear) scdr empty. once cleared, idle is not set again until the rxd line has been active and becomes idle again. rdrf is set if a received character is ready to be read from scdr. clear the rdrf ?g by reading scsr1 with rdrf set and then reading scdr. idle ?idle line detected ?g 1 (set) rxd line is idle. 0 (clear) rxd line is active. this ?g is set if the rxd line is idle. once cleared, idle is not set again until the rxd line has been active and becomes idle again. the idle ?g is inhibited when rwu = 1. clear idle by reading scsr1 with idle set and then reading scdr. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci1 status 1 (scsr1) $0074 tdre tc rdrf idle or nf fe pf 1100 0000 tpg 100
MC68HC11PH8 motorola 5-11 serial communications interface 5 or ?overrun error ?g 1 (set) overrun detected. 0 (clear) no overrun. or is set if a new character is received before a previously received character is read from scdr. clear the or ?g by reading scsr1 with or set and then reading scdr. nf ?noise error ?g 1 (set) noise detected. 0 (clear) unanimous decision. nf is set if the majority sample logic detects anything other than a unanimous decision. clear nf by reading scsr1 with nf set and then reading scdr. fe ?framing error 1 (set) zero detected. 0 (clear) stop bit detected. fe is set when a zero is detected where a stop bit was expected. clear the fe ?g by reading scsr1 with fe set and then reading scdr. pf ?parity error ?g 1 (set) incorrect parity detected. 0 (clear) parity correct. pf is set if received data has incorrect parity. clear pf by reading scsr1 with pe set and then reading scdr. tpg 101
motorola 5-12 MC68HC11PH8 serial communications interface 5 5.6.5 scsr2 ?sci status register 2 in the scsr2 only bit 0 is used, to indicate receiver active. the other seven bits always read zero. bits [7:1] ?not implemented; always read zero raf ?receiver active ?g (read only) 1 (set) a character is being received. 0 (clear) a character is not being received. 5.6.6 scdrh, scdrl ?sci data high/low registers scdrh/scdrl is a parallel register that performs two functions. it is the receive data register when it is read, and the transmit data register when it is written. reads access the receive data buffer and writes access the transmit data buffer. data received or transmitted is double buffered. if the sci is being used with 7 or 8-bit data, only scdrl needs to be accessed. note that if 9-bit data format is used, the upper register should be written ?st to ensure that it is transferred to the transmitter shift register with the lower register. r8 ?receiver bit 8 ninth serial data bit received when sci is con?ured for a nine data bit operation t8 ?transmitter bit 8 ninth serial data bit transmitted when sci is con?ured for a nine data bit operation bits [5:0] ?not implemented; always read zero r/t[7:0] ?receiver/transmitter data bits [7:0] sci data is double buffered in both directions. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci1 status 2 (scsr2) $0075 0000000raf 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci1 data high (scdrh) $0076 r8 t8 000000 undetned sci1 data low (scdrl) $0077 r7t7 r6t6 r5t5 r4t4 r3t3 r2t2 r1t1 r0t0 undetned tpg 102
MC68HC11PH8 motorola 5-13 serial communications interface 5 5.7 status ?gs and interrupts the sci transmitter has two status ?gs. these status ?gs can be read by software (polled) to tell when certain conditions exist. alternatively, a local interrupt enable bit can be set to enable each of these status conditions to generate interrupt requests. status ?gs are automatically set by hardware logic conditions, but must be cleared by software. this provides an interlock mechanism that enables logic to know when software has noticed the status indication. the software clearing sequence for these ?gs is automatic ?functions that are normally performed in response to the status ?gs also satisfy the conditions of the clearing sequence. tdre and tc ?gs are normally set when the transmitter is ?st enabled (te set to one). the tdre ?g indicates there is room in the transmit queue to store another data character in the transmit data register. the tie bit is the local interrupt mask for tdre. when tie is zero, tdre must be polled. when tie and tdre are one, an interrupt is requested. the tc ?g indicates the transmitter has completed the queue. the tcie bit is the local interrupt mask for tc. when tcie is zero, tc must be polled; when tcie is one and tc is one, an interrupt is requested. writing a zero to te requests that the transmitter stop when it can. the transmitter completes any transmission in progress before shutting down. only an mcu reset can cause the transmitter to stop and shut down immediately. if te is cleared when the transmitter is already idle, the pin reverts to its general purpose i/o function (synchronized to the bit-rate clock). if anything is being transmitted when te is cleared, that character is completed before the pin reverts to general purpose i/o, but any other characters waiting in the transmit queue are lost. the tc and tdre ?gs are set at the completion of this last character, even though te has been disabled. 5.7.1 receiver ?gs the sci receiver has seven status ?gs, three of which can generate interrupt requests. the status ?gs are set by the sci logic in response to speci? conditions in the receiver. these ?gs can be read (polled) at any time by software. refer to figure 5-3, which shows sci interrupt arbitration. when an overrun takes place, the new character is lost, and the character that was in its way in the parallel receive data register (rdr) is undisturbed. rdrf is set when a character has been received and transferred into the parallel rdr. the or ?g is set instead of rdrf if overrun occurs. a new character is ready to be transferred into the rdr before a previous character is read from the rdr. the nf, fe and pf ?gs provide additional information about the character in the rdr, but do not generate interrupt requests. the receiver active ?g (raf) indicates that the receiver is busy. the last receiver status ?g and interrupt source come from the idle ?g. the rxd line is idle if it has constantly been at logic one for a full character time. the idle ?g is set only after the rxd line has been busy and becomes idle. this prevents repeated interrupts for the time rxd remains idle. tpg 103
motorola 5-14 MC68HC11PH8 serial communications interface 5 figure 5-3 interrupt source resolution within sci no begin rdrf = 1? or = 1? tdre = 1? tc = 1? idle = 1? no valid sci interrupt request rie = 1? te = 1? re = 1? tie = 1? tcie = 1? ilie = 1? re = 1? valid sci interrupt request ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s no no no no no no no no no no no note: the bit names shown are for sci1. the diagram applies equally to sci2, when the appropriate bit names are substituted. tpg 104
MC68HC11PH8 motorola 5-15 serial communications interface 5 5.8 sci2 in addition to the subsystem described in the above paragraphs (sci1), the MC68HC11PH8 has another, similar, sci module (sci2). this system is identical to sci1, with the following exceptions: sci2 shares i/o with two port g pins: the sci2 transmit and receive functions are enabled by te2 and re2 respectively, in s2cr2. sci1 functions and data are handled by a register block at $0070?0077. the corresponding registers for sci2 are at addresses $0050?0057, as described in the following sections. the sci2 baud rate register is at address $0050/51. in addition to the sci functions,sci2 is also used for mi bus, controlled by bit 5 of s2cr1. refer to section 6 for full details of mi bus operation. 5.8.1 s2bdh, s2bdl ?sci2 baud rate control registers the contents of this register determine the baud rate for sci2. for details of the bits and the corresponding baud rates, see section 5.6.1. this register also controls the mi bus clock rate (see section 6). pin alternate function pg0 rxd2 pg1 txd2 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi baud high (s2bdh) $0050 b2tst b2spl b2rst s2b12 s2b11 s2b10 s2b9 s2b8 0000 0000 sci2/mi baud low (s2bdl) $0051 s2b7 s2b6 s2b5 s2b4 s2b3 s2b2 s2b1 s2b0 0000 0100 tpg 105
motorola 5-16 MC68HC11PH8 serial communications interface 5 5.8.2 s2cr1 ?sci2 control register 1 the s2cr1 register provides the control bits that determine word length and select the method used for the wake-up feature. bit 5 has an mi bus control function detailed below (for details of the other bits see section 5.6.2). woms2 ?wired-or mode for sci pins (pg1, pg0) 1 (set) txd2 and rxd2 are open drains if operating as inputs. 0 (clear) txd2 and rxd2 operate normally. mie2 ?motorola interface bus enable 2 1 (set) mi bus is enabled for this subsystem. 0 (clear) the sci functions normally. when mie2 is set, the sci2 registers, bits and pins assume the functionality required for mi bus. 5.8.3 s2cr2 ?sci2 control register 2 the s2cr2 register provides the control bits that enable or disable individual sci functions. for details of the bits, see section 5.6.3. 5.8.4 s2sr1 ?sci2 status register 1 the bits in s2sr1 indicate certain conditions in the sci hardware and are automatically cleared by special acknowledge sequences. for details of the bits, see section 5.6.4. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi control 1 (s2cr1) $0052 lops2 woms2 mie2 m2 wake2 ilt2 pe2 pt2 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi control 2 (s2cr2) $0053 tie2 tcie2 rie2 ilie2 te2 re2 rwu2 sbk2 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi status 1 (s2sr1) $0054 tdre2 tc2 rdrf2 idle2 or2 nf2 fe2 pf2 1100 0000 tpg 106
MC68HC11PH8 motorola 5-17 serial communications interface 5 5.8.5 s2sr2 ?sci2 status register 2 in the s2sr2 only bit 0 is used, to indicate receiver active (see section 5.6.5 for details). the other seven bits always read zero. 5.8.6 s2drh, s2drl ?sci2 data high/low registers s2drh/s2drl is a parallel register that performs two functions. it is the receive data register when it is read, and the transmit data register when it is written. reads access the receive data buffer and writes access the transmit data buffer. data received or transmitted is double buffered. see section 5.6.6 for more details. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi status 2 (s2sr2) $0055 0000000 raf2 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi data high (s2drh) $0056 r8b t8b 000000 undetned sci2/mi data low (s2drl) $0057 r7t7b r6t6b r5t5b r4t4b r3t3b r2t2b r1t1b r0t0b undetned tpg 107
motorola 5-18 MC68HC11PH8 serial communications interface this page intentionally left blank 5 tpg 108
MC68HC11PH8 motorola 6-1 motorola interconnect bus (mi bus) 6 6 motorola interconnect bus (mi bus) the motorola interconnect bus (mi bus) is a serial communications protocol which supports distributed real-time control ef?iently and with a high degree of noise immunity, at a typical bit rate for the data transfer of 20khz. the mi bus is suitable for medium speed networks requiring very low cost multiplex wiring; only one wire is required to connect to slave devices. ? the mi bus uses a push-pull sequence to transfer data. the master device, which in this case is the MC68HC11PH8, sends a push ?ld to the slave devices connected to the bus. the push ?ld contains data plus an address that is recognized by one of the slaves. the slave addressed returns data which the master pulls from the mi bus over the same wire. speci? details of the message format are covered later in this section. the mcu (master) can take the bus at any time, with a start bit that violates the rules of manchester biphase encoding. up to eight slave devices may be addressed by the mi bus. other features of mi bus include message validation, error detection, and default value setting. on the MC68HC11PH8 the mi bus module shares the same pins on port g as the sci2 module. data is transmitted (or ?ushed? via the txd pin, and received (?ulled? via the rxd pin. while data is being pushed, rxd will be disconnected from the receiver circuitry. the message frame is handled automatically in hardware. the mcu register interface is similar to that for the sci. mi bus functions are enabled by mie2 in s2cr1 ? related information on motorolas mi bus is contained in the following motorola publications: eb409/d ?the mi bus and product family for multiplexing systems an475/d ?single wire mi bus controlling stepper motors br477/d ?smart mover ?stepper motors with integrated serial bus controller pin alternate function pg0 rxd2 pg1 txd2 tpg 109
motorola 6-2 MC68HC11PH8 motorola interconnect bus (mi bus) 6 6.1 push-pull sequence communication between the mcu and the slave device always utilizes the same frame organization. first, the mcu sends serial data to the selected device. this data ?ld is called the ?ush ?ld? at the end of the push ?ld, the selected device automatically sends back to the mcu the data held during the push sequence. the mcu reads the serial data sent by the selected device. this data is called the ?ull ?ld and contains status information followed by the end-of-frame information from the selected device. 6.1.1 the push ?ld the push ?ld consists of a start bit, a push synchronization bit, a push data ?ld and a push address ?ld. the start consists of three time slots having the dominant logical state ?? the start marks the beginning of the message frame by violation of the rule of the manchester code. the push synchronization bit consists of a biphase coded ?? biphase coding will be discussed later. the push data ?ld consists of ?e bits of biphase coded data. the push address consists of three bits of biphase coded data. data and address are written to the lower byte of the sci data register (s2drl). the push data occupies the lower ?e bits and the push address occupies the upper three bits of the register. figure 6-1 mi bus timing 10 01 1 0 234 67 5 start stop start push sync d0 d1 d2 d3 d4 a0 a1 a2 pull sync s3 s2 s1 data address nrz data end of frame push teld (driven by mcu) pull teld (driven by slave) message frame push (biphase coded) pull (nrz coded) new frame push-pull function time slots txd pin (true data) mi bus wire bit telds tpg 110
MC68HC11PH8 motorola 6-3 motorola interconnect bus (mi bus) 6 6.1.2 the pull ?ld the pull ?ld consists of a pull synchronization bit, a pull data ?ld and an end of frame. the pull synchronization bit is a biphase coded ? and is initiated by the mcu during the time slot after the last address bit of the push ?ld. the pull data ?ld consists of an nrz coded transmission, each bit taking one time slot. once shifted in, the pull data is stored in the lower byte of the sci data register (s2drl). the end-of-frame ?ld is a square wave signal having a typical frequency of 20khz 1% tolerance (i.e. the bit rate of the push ?ld) when the data sent to the selected device is valid. 6.2 biphase coding manchester biphase l coding is used for the push ?ld bits. each bit requires two time slots to encode the logic value of the bit. this encoding allows the detection of a single error at the time slot level. bits are encoded as follows: 1 (set) in the ?st time slot, the logic level is set to zero, followed by a logic level one in the second time slot; 0 (clear) in the ?st time slot, the logic level is set to one, followed by a logic level zero in the second time slot. figure 6-2 biphase coding and error detection ?0? ?1? 01234567 01234567 t biphase coded signal biphase detection noise detection abab a? b? a b a? b? ab tpg 111
motorola 6-4 MC68HC11PH8 motorola interconnect bus (mi bus) 6 6.3 message validation the communication between the mcu and the selected device is valid when the mcu reads a pull data ?ld having correct codes (excluding the codes ?11 and ?00? followed by a square wave signal, having a frequency of 20khz, contained in the end-of-frame information. an mi bus error is detected when the pull ?ld contains the code ?11 followed by the end-of-frame permanently tied to logical state ?? this means that the communication between the mcu and the selected device was not accomplished. 6.3.1 controller detected errors there are three different mi bus error types which are detected by the selected slave device and are not mutually exclusive. the mcu cannot determine which error occurred. noise error slave devices take two samples in each time slot of the biphase encoded push ?ld. an error occurs when the two samples for each time slot are not the same logical level. biphase error slave devices receiving the push ?ld detect the biphase code. an error occurs when the two time slots of the biphase code do not yield a logical exclusive-or function. field error a ?ld error is detected when the ?ed-form of the push ?ld is violated. 6.3.2 mcu detected errors there is a fourth error that can be detected by the mcu. this error causes the noise ?g (nf) to be asserted in the s2sr1 register during the push ?ld sequence. bit error a bit error can be detected by the mcu during the push ?ld. the mi bus serial system monitors the bus via on-chip hardware at the rxd pin at the same time as sending data. a bit error is detected at that bit time when the value monitored is different from the bit value sent. tpg 112
MC68HC11PH8 motorola 6-5 motorola interconnect bus (mi bus) 6 figure 6-3 mi bus block diagram & lops2 woms2 wake2 + & & m2 ilt2 pe2 pt2 s2cr1 10/11-bit tx shift register h8 l 0 7 10/11-bit rx shift register 80 7 tie2 te2 rie2 ilie2 re2 rwu2 sbk2 s2cr2 tdre2 tc2 or2 rdrf2 s2sr1 raf2 s2sr2 data recovery rxd2 txd2 receive buffer r8 transmit buffer t8 transmitter control receiver control sci interrupt request woms woms mie2 pt2 te2 sbk2 mie2 re2 stop start s2bdl s2bdh rate generator st4xck rie2 idle2 ilie2 rdrf2 tc2 tcie2 tdre2 tie2 note: ? = always reads as zero flag control internal data bus mie2 ? ? ? tcie2 nf2 = not used in mi bus mode clock & tpg 113
motorola 6-6 MC68HC11PH8 motorola interconnect bus (mi bus) 6 6.4 interfacing to mi bus physically the mi bus consists of only a single wire. in the example shown in figure 6-4, only a single transistor and a few passive components are required to connect up the MC68HC11PH8 for full mi bus operation. the transistor serves both to drive the mi bus during the push ?ld and to protect the mcu tx pin from voltage transients generated in the wiring. without the transistor, emi could damage the tx pin. similarly, the input pin (rx) is protected from emi by clamping it to the mcu supply rails with two diodes. when a load dump occurs, the zener diode (18v) is switched on and hence turns the transistor on; this generates the logic ? state on the mi bus. after eight time slots (200ms) of continuous ? state, all devices on the mi bus will have their outputs disabled. the mi bus line can take two states, recessive or dominant. the recessive state (?? is represented by 5v, through a pull-up resistor of 10k w . the dominant state (?? is represented by a maximum 0.3v (v cesat of the transistor, t1). the bus load depends on the number of devices on the bus. each device has a pull-up resistor of 10k w . an external termination resistor is used to stabilize the load resistance of the bus at 600 w . figure 6-4 a typical interface between the MC68HC11PH8 and the mi bus 1.2k w +12v 18v 4.7k w 3.9k w 10k w mi bus tx rx mcu v dd v dd t1 v dd v ss 10k w 22k w tpg 114
MC68HC11PH8 motorola 6-7 motorola interconnect bus (mi bus) 6 6.5 mi bus clock rate the mi bus clock rate is set via the sci baud registers. to use the mi bus, the st4xck clock frequency that drives the sci clock generator must be selected to match the minimum resolution of the mi bus logic. this is expressed by the following formula: st4xck = 16 ?2n ?(2 ?push_?ld_bit_rate) = 16 ?2n ?40khz = n ?1280khz where ? is an integer and 20khz is the minimum push ?ld bit rate for the mi bus. values for st4xck could be 1280khz, 2560khz, ? n ?1280khz. the value ? is the modulus for the mi bus baud register (see section 6.6.2). st4xck may be the output of the pll circuit or it may be the extal input of the mcu. refer to section 2.5. 6.6 sci2/mi bus registers mi bus operation is controlled by the same group of registers as is used for the sci. however the functions of some of the bits are modi?d when in mi bus mode. a description of the registers, as applicable to the mi bus function, is given here. note: in mi bus mode, bits that have no meaning are reserved by motorola, and are not described. tpg 115
motorola 6-8 MC68HC11PH8 motorola interconnect bus (mi bus) 6 6.6.1 init2 ?eeprom mapping and mi bus delay register this register sets the mi bus delay time. init2 may be read at any time but bits 7? may be written only once after reset in normal modes (bits 3, 1 and 0 may be written at any time). ee[3:0] ?eeprom map position (refer to section 3.3.2.3.) eeprom is located at $xd00?xfff, where x is the hexadecimal digit represented by ee[3:0]. strx ?stretch extended (refer to section 3.3.2.3) 1 (set) all external accesses are extended by one e clock cycle. 0 (clear) only external access from $0000 to $1fff (romad set) or from $c000 to $dfff (romad clear) are extended by one e clock cycle. bit 2 ?not implemented, always read zero. m2dl1:m2dl0 ?mi bus delay select these bits are used to set up the delay for the start of the nrz receive for mi bus operation as shown (for a 20khz bit rate) in the following table. (1) 20khz bit rate requires 25 m s (40khz) time slots. (2) 25 m s ? 16 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset eeprom mapping (init2) $0037 ee3 ee2 ee1 ee0 strx 0 m2dl1 m2dl0 0000 0000 m2dl1 m2dl0 delay factor delay time (1) 0 0 1 1.5625 m s (2) 0 1 2 3.1250 m s 1 0 3 4.6875 m s 1 1 4 6.2500 m s tpg 116
MC68HC11PH8 motorola 6-9 motorola interconnect bus (mi bus) 6 6.6.2 s2bdh, s2bdl ?mi bus clock rate control registers the contents of this register determine the clock rate for mi bus. s2b[12:0] ?sci baud rate/ mi bus clock rate selects use the following formula to calculate mi bus clock rate. refer to the table of baud rate control values (see table 5-1) for example rates: where the baud rate control value (br) is the contents of s2bdh/l (br = 1, 2, 3,... 8191). the clock rate generator is disabled if br = 0, or if neither the receiver nor transmitter is enabled (both re and te in sccr2 are cleared). writes to the baud rate registers will only be successful if the last (or only) byte written is scbdl. the use of an std instruction is recommended as it guarantees that the bytes are written in the correct order. note: st4xck may be the output of the pll circuit or it may be the extal input of the mcu. selection is made by the mcs bit in the pllcr (see section 2.5). 6.6.3 s2cr1 ?mi bus control register 1 woms2 ?wired-or mode for mi bus pins (pg0, pg1) 1 (set) txd2 and rxd2 are open drains if operating as outputs. 0 (clear) txd2 and rxd2 operate normally. mie2 ?motorola interface bus enable 2 1 (set) mi bus is enabled for this subsystem. 0 (clear) the sci functions normally. when mie2 is set, the sci2 registers, bits and pins assume the functionality required for mi bus. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi baud high (s2bdh) $0050 b2tst b2spl b2rst s2b12 s2b11 s2b10 s2b9 s2b8 0000 0000 sci2/mi baud low (s2bdl) $0051 s2b7 s2b6 s2b5 s2b4 s2b3 s2b2 s2b1 s2b0 0000 0100 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi control 1 (s2cr1) $0052 ? woms2 mie2 ????pt2 0000 0000 mi bus clock rate st 4 xck 16 2 br () ---------------------------- - = tpg 117
motorola 6-10 MC68HC11PH8 motorola interconnect bus (mi bus) 6 pt2 ?mi bus tx polarity (see section 5.6.2) 1 (set) mi bus transmit pin will send inverted data. 0 (clear) mi bus transmit pin functions normally. this control bit allows for different driver interfaces between the mcu and the mi bus wire. 6.6.4 s2cr2 ?mi bus control register 2 rie2 ?receiver interrupt enable 2 1 (set) mi bus interrupt requested when rdrf2 ?g is set. 0 (clear) rdrf2 and or2 interrupts disabled. te2 ?transmitter enable 2 1 (set) transmitter enabled and port pin dedicated to the mi bus. 0 (clear) transmitter disabled. re2 ?receiver enable 2 1 (set) port pin dedicated to the mi bus; the receiver is enabled by a pull sync and is inhibited during a push ?ld. 0 (clear) receiver disabled. sbk2 ?send break 2 1 (set) mi transmit line is set low for 20 time slots. 0 (clear) no action. when an mi bus wire is held low for eight or more time slots an internal circuit on any slave device connected to the bus may reset or preset the device with default values. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi control 2 (s2cr2) $0053 ? ? rie2 ? te2 re2 ? sbk2 0000 0000 tpg 118
MC68HC11PH8 motorola 6-11 motorola interconnect bus (mi bus) 6 6.6.5 s2sr1 ?mi bus status register 1 the bits in s2sr1 indicate certain conditions in the mi bus hardware and are automatically cleared by special acknowledge sequences. the receive related ?g bits in s2sr1 (rdrf2, or2 and nf2) are cleared by a read of this register followed by a read of the transmit/receive data register. however, only those bits that were set when s2sr1 was read will be cleared by the subsequent read of the transmit/receive data register. rdrf2 ?receive data register full ?g 2 1 (set) contents of the receiver serial shift register have been transferred to the receiver data register. 0 (clear) contents of the receiver serial shift register have not been transferred to the receiver data register. this bit is set when the contents of the receiver serial shift register have been transferred to the receiver data register. the eof (end-of-frame) during an mi bus pull-?ld is a continuous square wave, which will result in multiple rdrfs. this may be dealt with in any of the following ways: by clearing the rie2 mask, ignoring unneeded rdrf2s, initiating a push ?ld, waiting for tdre2 ? and then clearing the rdrf2; by clearing the re2 bit when a pull ?ld is complete, followed by setting the re2 bit after the tdre2 ? ?g associated with the next push ?ld is asserted; by disabling the mi bus. or2 ?bit error 2 1 (set) a bit error has been detected. 0 (clear) no bit error has been detected. this bit is set when a push ?ld bit value on the mi bus does not match the bit value that was sent. this is known as an mi bus bit error. or2 does not generate an interrupt request in mi bus mode. ? note that tdre2 and tc2 will both behave in the same way as during normal sci transmissions. the mi bus will still be receiving when the tc2 bit becomes set, hence any queued transmission will not start until the current pull ?ld has ?ished. see also section 5.6.4. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci2/mi status 1 (s2sr1) $0054 ? ? rdrf2 ? or2 nf2 ? ? 1100 0000 tpg 119
motorola 6-12 MC68HC11PH8 motorola interconnect bus (mi bus) 6 nf2 ?noise error ?g 2 1 (set) noise detected. 0 (clear) no noise detected. this bit is set when noise is detected on the receive line during an mi bus pull ?ld. 6.6.6 s2sr2 ?mi bus2 status register 2 raf2 ?receiver active ?g (read only) 1 (set) a character is being received. 0 (clear) a character is not being received. 6.6.7 s2drl ?mi bus2 data register this register forms the 8-bit data/address word for the mi push ?ld and contains the 3-bit data word received as the mi pull ?ld. r/t[7:0] ?receiver/transmitter data bits [7:0] read: reads access the three bits of pull ?ld data (stored in bits 3?) of the read-only mi bus receive data register. bits [7:4, 0] are a ?ed data pattern when a valid status and end-of-frame is returned. a valid status is represented by the following data pattern: 0101 xxx1 (bits 7?), where ?xx is the status. all ones in the receive data register indicate that an error occurred on the mi bus. bits are received lsb ?st by the mcu, and the status bits map as shown in the above table. write: writes access the eight bits of the write-only mi bus transmit data register. mi bus devices require a 5-bit data pattern followed by a 3-bit address pattern to be sent during the push ?ld. the data pattern is mapped to the lowest ?e bits of the data register and the address to the highest three bits, as shown in the above table. thus mi-data[4:0] is written to s2drl[4:0] and mi-address[2:0] is written to s2drl[7:5]. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci/mi 2 status 2 (s2sr2) $0055 0000000 raf2 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset sci/mi 2 data low (s2drl) $0057 r7t7b r6t6b r5t5b r4t4b r3t3b r2t2b r1t1b r0t0b undetned 0101s1s2s31 pull teld a2 a1 a0 d4 d3 d2 d1 d0 push teld tpg 120
MC68HC11PH8 motorola 7-1 serial peripheral interface 7 7 serial peripheral interface ? the serial peripheral interface (spi), an independent serial communications subsystem, allows the mcu to communicate synchronously with peripheral devices, such as transistor-transistor logic (ttl) shift registers, liquid crystal (lcd) display drivers, analog-to-digital converter subsystems, and other microprocessors. the spi is also capable of inter-processor communication in a multiple master system. the spi system can be con?ured as either a master or a slave device, with data rates as high as one half of the e clock rate when con?ured as a master and as fast as the e clock rate when con?ured as a slave. the spi shares i/o with four of port ds pins and is enabled by spe in the spcr: 7.1 functional description the central element in the spi system is the block containing the shift register and the read data buffer (see figure 7-1). the system is single buffered in the transmit direction and double buffered in the receive direction. this means that new data for transmission cannot be written to the shifter until the previous transfer is complete; however, received data is transferred into a parallel read data buffer so the shifter is free to accept a second serial character. as long as the ?st character is read out of the read data buffer before the next serial character is ready to be transferred, no overrun condition occurs. a single mcu register address is used for reading data from the read data buffer and for writing data to the shifter. the spi status block represents the spi status functions (transfer complete, write collision, and mode fault) performed by the serial peripheral status register (spsr). the spi control block represents those functions that control the spi system through the serial peripheral control register (spcr). ? the MC68HC11PH8 contains two serial peripheral interfaces having similar operation. for ease of reference, a full description of spi1 is given ?st, followed by a summary of spi2 (section 7.6). pin alternate function pd2 miso1 pd3 mosi1 pd4 sck1 pd5 ss1 tpg 121
motorola 7-2 MC68HC11PH8 serial peripheral interface 7 7.2 spi transfer formats during an spi transfer, data is simultaneously transmitted and received. a serial clock line synchronizes shifting and sampling of the information on the two serial data lines. a slave select line allows individual selection of a slave spi device; slave devices that are not selected do not interfere with spi bus activities. on a master spi device, the select line can optionally be used to indicate a multiple master bus contention. refer to figure 7-2. figure 7-1 spi block diagram spcr e spi control register spsr e spi status register divider spdr e spi data register shift control logic read data buffer 8-bit shift register opt2 e options register 2 ? 2 ? 4 ? 8 ? 16 ? 32 ? 64 ? 128 select clock logic spi control miso pd2 mosi pd3 sck pd4 ss pd5 s m s m s m pin control logic mcu system clock spie spe dwom mstr cpol cpha spr1 spr0 spif wcol modf lsbf spr2 mstr spe dwom mstr spe spie lsbf clock spi clock (master) spi interrupt request internal bus tpg 122
MC68HC11PH8 motorola 7-3 serial peripheral interface 7 7.2.1 clock phase and polarity controls software can select one of four combinations of serial clock phase and polarity using two bits in the spi control register (spcr). the clock polarity is speci?d by the cpol control bit, which selects an active high or active low clock, and has no signi?ant effect on the transfer format. the clock phase (cpha) control bit selects one of two different transfer formats. the clock phase and polarity should be identical for the master spi device and the communicating slave device. in some cases, the phase and polarity are changed between transfers to allow a master device to communicate with peripheral slaves having different requirements. when cpha equals zero, the ss line must be deasserted and reasserted between each successive serial byte. also, if the slave writes data to the spi data register (spdr) while ss is low, a write collision error results. when cpha equals one, the ss line can remain low between successive transfers. 7.3 spi signals the following paragraphs contain descriptions of the four spi signals: master in slave out (miso), master out slave in (mosi), serial clock (sck), and slave select (ss ). any spi output line must have its corresponding data direction bit in ddrd register set. if the ddr bit is clear, that line is disconnected from the spi logic and becomes a general-purpose input. all spi input lines are forced to act as inputs regardless of the state of the corresponding ddr bits in ddrd register. figure 7-2 spi transfer format 1 2 3 4 5 6 7 8 msb654321lsb msb654321 lsb sck cycle # (for reference) sck (cpol=0) sck (cpol=1) sample input data out (cpha=0) sample input data out (cpha=1) ss (to slave) note: this tgure shows the lsbf=0 (default) case. if lsbf=1, data is transferred in the reverse order (lsb trst). tpg 123
motorola 7-4 MC68HC11PH8 serial peripheral interface 7 7.3.1 master in slave out miso is one of two unidirectional serial data signals. it is an input to a master device and an output from a slave device. the miso line of a slave device is placed in the high-impedance state if the slave device is not selected. 7.3.2 master out slave in the mosi line is the second of the two unidirectional serial data signals. it is an output from a master device and an input to a slave device. the master device places data on the mosi line a half-cycle before the clock edge that the slave device uses to latch the data. 7.3.3 serial clock sck, an input to a slave device, is generated by the master device and synchronizes data movement in and out of the device through the mosi and miso lines. master and slave devices are capable of exchanging a byte of information during a sequence of eight clock cycles. there are four possible timing relationships that can be chosen by using control bits cpol and cpha in the serial peripheral control register (spcr). both master and slave devices must operate with the same timing. the spi clock rate select bits, spr[1:0], in the spcr of the master device, select the clock rate. in a slave device, spr[1:0] have no effect on the operation of the spi. 7.3.4 slave select the slave select ss input of a slave device must be externally asserted before a master device can exchange data with the slave device. ss must be low before data transactions begin and must stay low for the duration of the transaction. the ss line of the master must be held high. if it goes low, a mode fault error ?g (modf) is set in the serial peripheral status register (spsr). to disable the mode fault circuit, write a one in bit 5 of the port d data direction register. this sets the ss pin to act as a general-purpose output, rather than a dedicated input to the slave select circuit, thus inhibiting the mode fault ?g. the other three lines are dedicated to the spi whenever the serial peripheral interface is on. the state of the master and slave cpha bits affects the operation of ss . cpha settings should be identical for master and slave. when cpha = 0, the shift clock is the or of ss with sck. in this clock phase mode, ss must go high between successive characters in an spi message. when cpha = 1, ss can be left low between successive spi characters. in cases where there is only one spi slave mcu, its ss line can be tied to v ss as long as only cpha = 1 clock mode is used. tpg 124
MC68HC11PH8 motorola 7-5 serial peripheral interface 7 7.4 spi system errors two kinds of system errors can be detected by the spi system. the ?st type of error arises in a multiple-master system when more than one spi device simultaneously tries to be a master. this error is called a mode fault. the second type of error, write collision, indicates that an attempt was made to write data to the spdr while a transfer was in progress. when the spi system is con?ured as a master and the ss input line goes to active low, a mode fault error has occurred ?usually because two devices have attempted to act as master at the same time. in the case where more than one device is concurrently con?ured as a master, there is a chance of contention between two pin drivers. for push-pull cmos drivers, this contention can cause permanent damage. the mode fault detection circuitry attempts to protect the device by disabling the drivers. the mstr control bit in the spcr and all four ddrd control bits associated with the spi are cleared and an interrupt is generated (subject to masking by the spie control bit and the i bit in the ccr). other precautions may need to be taken to prevent driver damage. if two devices are made masters at the same time, the mode fault detector does not help protect either one unless one of them selects the other as slave. the amount of damage possible depends on the length of time both devices attempt to act as master. a write collision error occurs if the spdr is written while a transfer is in progress. because the spdr is not double buffered in the transmit direction, writes to spdr cause data to be written directly into the spi shift register. because this write corrupts any transfer in progress, a write collision error is generated. the transfer continues undisturbed, and the write data that caused the error is not written to the shifter. a write collision is normally a slave error because a slave has no control over when a master initiates a transfer. a master knows when a transfer is in progress, so there is no reason for a master to generate a write-collision error, although the spi logic can detect write collisions in both master and slave devices. the spi con?uration determines the characteristics of a transfer in progress. for a master, a transfer begins when data is written to spdr and ends when spif is set. for a slave with cpha equal to zero, a transfer starts when ss goes low and ends when ss returns high. in this case, spif is set at the middle of the eighth sck cycle when data is transferred from the shifter to the parallel data register, but the transfer is still in progress until ss goes high. for a slave with cpha equal to one, transfer begins when the sck line goes to its active level, which is the edge at the beginning of the ?st sck cycle. the transfer ends when spif is set, for a slave in which cpha=1. 7.5 spi registers the three spi registers, spcr, spsr, and spdr, provide control, status, and data storage functions. refer to the following information for a description of how these registers are organized. tpg 125
motorola 7-6 MC68HC11PH8 serial peripheral interface 7 7.5.1 spcr ?spi control register spie ?serial peripheral interrupt enable 1 (set) a hardware interrupt sequence is requested each time spif or modf is set. 0 (clear) spi interrupts are inhibited. set the spie bit to a one to request a hardware interrupt sequence each time the spif or modf status ?g is set. spi interrupts are inhibited if this bit is clear or if the i bit in the condition code register is one. spe ?serial peripheral system enable 1 (set) port d [5:2] is dedicated to the spi. 0 (clear) port d has its default i/o functions and the clock generator is stopped. when the spe bit is set, the port d pins 2, 3, 4, and 5 are dedicated to the spi functions and lose their general purpose i/o functions. when the spi system is enabled and expects any of pd[4:2] to be inputs then those pins will be inputs regardless of the state of the associated ddrd bits. if any of pd[4:2] are expected to be outputs then those pins will be outputs only if the associated ddrd bits are set. however, if the spi is in the master mode, ddd5 determines whether pd5 is an error detect input (ddd5 = 0) or a general-purpose output (ddd5 = 1). dwom ?port d wired-or mode 1 (set) port d [5:2] buffers con?ured for open-drain outputs. 0 (clear) port d [5:2] buffers con?ured for normal cmos outputs. mstr ?master mode select 1 (set) master mode 0 (clear) slave mode cpol ?clock polarity 1 (set) sck is active low. 0 (clear) sck is active high. when the clock polarity bit is cleared and data is not being transferred, the sck pin of the master device has a steady state low value. when cpol is set, sck idles high. refer to figure 7-2 and section 7.2.1. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi control (spcr) $0028 spie spe dwom mstr cpol cpha spr1 spr0 0000 01uu tpg 126
MC68HC11PH8 motorola 7-7 serial peripheral interface 7 cpha ?clock phase the clock phase bit, in conjunction with the cpol bit, controls the clock-data relationship between master and slave. the cpha bit selects one of two different clocking protocols. refer to figure 7-2 and section 7.2.1. spr1 and spr0 ?spi clock rate selects these two bits select the spi clock rate, as shown in table 7-1. note that spr2 is located in the opt2 register, and that its state on reset is zero. 7.5.2 spsr ?spi status register spif ?spi interrupt complete ?g 1 (set) data transfer to external device has been completed. 0 (clear) no valid completion of data transfer. spif is set upon completion of data transfer between the processor and the external device. if spif goes high, and if spie is set, a serial peripheral interrupt is generated. to clear the spif bit, read the spsr with spif set, then access the spdr. unless spsr is read (with spif set) ?st, attempts to write spdr are inhibited. table 7-1 spi clock rates spr[2:0] e clock divide ratio spi clock frequency ( o baud rate) for: e = 2mhz e = 3mhz e = 4mhz 0 0 0 2 1.0 mhz 1.5 mhz 2.0 mhz 0 0 1 4 500 khz 750khz 1.0 mhz 0 1 0 16 125 khz 187.5 khz 250 khz 0 1 1 32 62.5 khz 93.7 khz 125 khz 1 0 0 8 250 khz 375 khz 500 khz 1 0 1 16 125 khz 187.5 khz 250 khz 1 1 0 64 31.3 khz 46.9 khz 62.5 khz 1 1 1 128 15.6 khz 23.4 khz 31.3 khz address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi status (spsr) $0029 spif wcol 0 modf 0000 0000 0000 tpg 127
motorola 7-8 MC68HC11PH8 serial peripheral interface 7 wcol ?write collision 1 (set) write collision. 0 (clear) no write collision. clearing the wcol bit is accomplished by reading the spsr (with wcol set) followed by an access of spdr. refer to section 7.3.4 and section 7.4. modf ?mode fault 1 (set) mode fault. 0 (clear) no mode fault. to clear the modf bit, read the spsr (with modf set), then write to the spcr. refer to section 7.3.4 and section 7.4. bits [5, 3:0] ? not implemented; always read zero. 7.5.3 spdr ?spi data register the spdr is used when transmitting or receiving data on the serial bus. only a write to this register initiates transmission or reception of a byte, and this only occurs in the master device. at the completion of transferring a byte of data, the spif status bit is set in both the master and slave devices. a read of the spdr is actually a read of a buffer. to prevent an overrun and the loss of the byte that caused the overrun, the ?st spif must be cleared by the time a second transfer of data from the shift register to the read buffer is initiated. spi is double buffered in and single buffered out. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi data (spdr) $002a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned tpg 128
MC68HC11PH8 motorola 7-9 serial peripheral interface 7 7.5.4 opt2 ?system con?uration options register 2 lirdv ?lir driven (refer to section 3) 1 (set) enable lir push-pull drive. 0 (clear) lir not driven on moda/lir pin. cwom ?port c wired-or mode (refer to section 4) 1 (set) port c outputs are open-drain. 0 (clear) port c operates normally. strch ?stretch external accesses (refer to section 3) 1 (set) off-chip accesses are extended by one e clock cycle. 0 (clear) normal operation. irvne ?internal read visibility/not e (refer to section 3) 1 (set) data from internal reads is driven out of the external data bus. 0 (clear) no visibility of internal reads on external bus. in single chip mode this bit determines whether the e clock drives out from the chip. 1 (set) e pin is driven low. 0 (clear) e clock is driven out from the chip. lsbf ?lsb ?st enable 1 (set) spi1 data is transferred lsb ?st. 0 (clear) spi1 data is transferred msb ?st. if this bit is set, data, which is usually transferred msb ?st, is transferred lsb ?st. lsbf does not affect the position of the msb and lsb in the data register. reads and writes of the data register always have msb in bit 7. spr2 ?spi clock rate select when set, spr2 adds a divide-by-4 prescaler to the spi clock chain. with the two bits in the spcr, this bit speci?s the spi clock rate. refer to table 7-1. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system contg. options 2 (opt2) $0038 lirdv cwom strch irvne lsbf spr2 ext4x dise x00x 0000 tpg 129
motorola 7-10 MC68HC11PH8 serial peripheral interface 7 ext4x ?4xclk or extal clock output select (refer to section 3) 1 (set) extali clock output on the 4xout pin. 0 (clear) 4xclk clock output on the 4xout pin. dise ?e clock output disable (refer to section 3) 1 (set) no e clock output. 0 (clear) e clock is output normally. 7.6 spi2 in addition to the subsystem described in the above paragraphs (spi1), the MC68HC11PH8 has another spi module (spi2). this system is identical to spi1, with the following exceptions: spi2 shares i/o with four port g pins: spi1 functions and data are handled by a register block at $0028?002a along with the system con?uration options register 2 at address $0038. the corresponding registers for spi2 are at addresses $004c?004e along with the spi2 control options register at address $004f. the spi2 registers are described in the following sections. pin alternate function pg2 miso2 pg3 mosi2 pg4 sck2 pg5 ss2 tpg 130
MC68HC11PH8 motorola 7-11 serial peripheral interface 7 7.6.1 sp2cr ?spi2 control register for details of the functions of bits 2,3,4,6 and 7, see section 7.5.1. gwom ?port g wired-or mode 1 (set) port g [5:2] buffers con?ured for open-drain outputs. 0 (clear) port g [5:2] buffers con?ured for normal cmos outputs. sp2r1 and sp2r0 ?spi2 clock rate selects these two bits, along with the sp2r2 bit, select the spi clock rate as shown in table 7-1. note that sp2r2 is located in the sp2opt register, and that its state on reset is zero. 7.6.2 sp2sr ?spi2 status register for a description of bits 4,6 and 7, see section 7.5.2. 7.6.3 sp2dr ?spi2 data register for a description of this register, see section 7.5.3. 7.6.4 sp2opt ?spi2 control options register for a description of bits 2 and 3, see section 7.5.4. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi2 control (sp2cr) $004c sp2ie sp2e gwom mstr2 cpol2 cpha2 sp2r1 sp2r0 0000 01uu address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi2 status (sp2sr) $004d sp2if wcol2 0 modf2 0000 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi2 data (sp2dr) $004e (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset spi2 control options (sp2dr) $004f 0000 lsbf2 sp2r2 0 0 0000 0000 tpg 131
motorola 7-12 MC68HC11PH8 serial peripheral interface this page intentionally left blank 7 tpg 132
MC68HC11PH8 motorola 8-1 timing system 8 8 timing system the MC68HC11PH8 has three timing modules: a 16-bit timer system (incorporating pulse accumulator, rti and cop), a pulse width modulation (pwm) system and an 8-bit modulus timing system comprising timers a, b and c. 8.1 16-bit timer the m68hc11 timing system is composed of several clock divider chains. the main clock divider chain includes a 16-bit free-running counter, which is driven by a programmable prescaler. the main timers programmable prescaler provides one of the four clocking rates to drive the 16-bit counter. two prescaler control bits select the prescale rate. the prescaler output divides the system clock by 1, 4, 8, or 16. taps from this main clocking chain drive circuitry may be used to generate the slower clocks used by the pulse accumulator, the real-time interrupt (rti), the computer operating properly (cop) watchdog subsystems and the lcd module. refer to figure 8-1 and figure 8-2. all main timer system activities can be referenced to the free-running counter. the counter begins incrementing from $0000 as the mcu comes out of reset, and continues to the maximum count, $ffff. at the maximum count, the counter rolls over to $0000, sets an over?w ?g and continues to increment. as long as the mcu is running in a normal operating mode, there is no way to reset, change or interrupt the counting, unless, for reduced power consumption and if the pll is in operation, the 16-bit counter is disabled under control of the t16en bit (see section 8.1.1.1). the capture/compare subsystem features three input capture channels, four output compare channels and one channel that can be selected to perform either input capture or output compare. each of the input capture functions has its own 16-bit input capture register (time capture latch) and each of the output compare functions has its own 16-bit compare register. all timer functions, including the timer over?w and rti, have their own interrupt controls and separate interrupt vectors. see table 8-1 for related frequencies and periods. the pulse accumulator contains an 8-bit counter and edge select logic. the pulse accumulator can operate in either event counting mode or gated time accumulation mode. during event counting mode, the pulse accumulators 8-bit counter increments when a speci?d edge is detected on an input pin. during gated time accumulation mode, an internal clock source (st4xck/2 8 ) increments the 8-bit counter while an input signal has a predetermined logic level. tpg 133
motorola 8-2 MC68HC11PH8 timing system 8 the real-time interrupt (rti) is a programmable periodic interrupt circuit that permits pacing of the execution of software routines by selecting one of four interrupt rates. it may be clocked by the 16-bit timer (st4xck/2 15 ) or by the under?w of 8-bit modulus timer a (clk64), depending on whether or not the pll system is active (see figure 8-1, figure 8-2 and section 8.1.5). the cop watchdog clock input may be tapped off from the free-running counter chain (st4xck/2 17 ), or may be the under?w of the 8-bit modulus timer a (clk64/4), depending on whether or not the pll system is active (see figure 8-1, figure 8-2 and section 8.1.6). the cop automatically times out unless it is serviced within a speci? time by a program reset sequence. if the cop is allowed to time out, a reset is generated, which drives the reset pin low to reset the mcu and the external system (see section 10). the lcd module can drive up to four lcd segments, and may be clocked by the 16-bit timer (st4xck/2 18 ), or by the under?w of the 8-bit modulus timer a (clk64 or clk64/8), depending on whether or not the pll system is active (see figure 8-1, figure 8-2 and section 2). (1) crystal frequencies are valid only if the pll is not active. table 8-1 timer resolution and capacity clock 4.0mhz 8.0mhz 12.0mhz 16.0mhz st4xck crystal (1) control bits pr[1:0] 1.0mhz 2.0mhz 3.0mhz 4.0mhz st4xck/4 clock 1000ns 500ns 333ns 250ns 4/st4xck period 0 0 1.0 m s 65.536ms 500ns 32.768ms 333ns 21.845ms 250ns 16.384ms 4/st4xck 2 18 /st4xck e resolution e over?ow 0 1 4.0 m s 262.14ms 2.0 m s 131.07ms 1.333 m s 87.381ms 1.0 m s 65.536ms 16/st4xck 2 20 /st4xck e resolution e over?ow 1 0 8.0 m s 524.29ms 4.0 m s 262.14ms 2.667 m s 174.76ms 2.0 m s 131.07ms 32/st4xck 2 21 /st4xck e resolution e over?ow 1 1 16.0 m s 1049 ms 8.0 m s 524.29ms 5.333 m s 349.53ms 4.0 m s 262.14ms 64/st4xck 2 22 /st4xck e resolution e over?ow tpg 134
MC68HC11PH8 motorola 8-3 timing system 8 8.1.1 timer enable control the 16-bit timer may be enabled or disabled under control of the t16en bit in the pll control register. 8.1.1.1 pllcr ?pll control register pllon ?pll on (see section 2.5.4.1) 1 (set) switch pll on. 0 (clear) switch pll off. bcs ?bus clock select (see section 2.5.4.1) 1 (set) vcoout output drives the clock circuit (4xclk). 0 (clear) extali drives the clock circuit (4xclk). auto ?automatic bandwidth control (see section 2.5.4.1) 1 (set) automatic bandwidth control selected. 0 (clear) manual bandwidth control selected. bwc ?bandwidth control (see section 2.5.4.1) 1 (set) high bandwidth control selected. 0 (clear) low bandwidth control selected. vcot ?vco test (test mode only, see section 2.5.4.1) 1 (set) loop ?ter operates as speci?d by auto and bwc. 0 (clear) low bandwidth mode of the pll ?ter is disabled. mcs ?module clock select (see section 2.5.4.1) 1 (set) 4xclk is the source for the sci and timer divider chain. 0 (clear) extali is the source for the sci and timer divider chain. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pll control (pllcr) $002e pllon bcs auto bwc vcot mcs t16en wen 1010 1010 tpg 135
motorola 8-4 MC68HC11PH8 timing system 8 t16en ?16-bit timer clock enable 1 (set) 16-bit timer clock enabled. 0 (clear) 16-bit timer clock disabled. power consumption may be reduced by disabling the 16-bit timer clock. this bit cannot be cleared whilst vddsyn is low, as then the 16-bit timer provides the clock source for the cop and rti. when vddsyn is high, the 8-bit modulus timer a supplies the clock source for the cop and rti functions, which are therefore independent from the 16-bit timer clock. reset sets this bit. wen ?wait enable (see section 2.5.4.1) 1 (set) low-power wait mode selected (pll set to ?dle in wait mode). 0 (clear) do not alter the 4xclk during wait mode. 8.1.2 timer structure the timer functions share i/o with all eight pins of port a: figure 8-3 shows the capture/compare system block diagram. the port a pin control block includes logic for timer functions and for general-purpose i/o. for pins pa3, pa2, pa1 and pa0, this block contains both the edge-detection logic and the control logic that enables the selection of which edge triggers an input capture. the digital level on pa[3:0] can be read at any time (read porta register), even if the pin is being used for the input capture function. pins pa[6:3] are used either for general-purpose i/o, or as output compare pins. when one of these pins is being used for an output compare function, it cannot be written directly as if it were a general-purpose output. each of the output compare functions (oc[5:2]) is related to one of the port a output pins. output compare 1 (oc1) has extra control logic, allowing it optional control of any combination of the pa[7:3] pins. the pa7 pin can be used as a general-purpose i/o pin, as an input to the pulse accumulator or as an oc1 output pin. pin alternate function pa0 ic3 pa1 ic2 pa2 ic1 pa3 oc5 and/or oc1, or ic4 pa4 oc4 and/or oc1 pa5 oc3 and/or oc1 pa6 oc2 and/or oc1 pa7 pai and/or oc1 tpg 136
MC68HC11PH8 motorola 8-5 timing system 8 figure 8-1 timer clock divider chains (pll enabled ?vddsyn high) ? 2 6 set q q reset ff2 set q q reset ff1 + baud ? 1, 2, 3, 4,, 8191 sci receiver clock sci transmitter clock e clock prescaler ? 2, 4, 8,16, 32, 64, 128 spr[2:0] spi pulse accumulator prescaler ? 1, 2, 4, 64 rtr[1:0] real time interrupt tcnt tof prescaler ? 1, 4, 16, 64 cr[1:0] system reset clear cop timer force cop reset ic/oc ? 4 ? 16 internal bus clock crystal oscillator pll bus clock select module clock select ? 2 ? 4 ? 2 lcd clock select ph2 (for cpu, pwm, lcd 8-bit modulus timer a prescaler ? 1, 4, 8, 16 pr[1:0] lcdck bcs mcs clk64 st4xck 4xclk extali 1 0 1 0 0 1 sbr[12:0] a/d and memory) ? 4 (baud rate) ? 2 prescaler ? 1, 4, 8 csa[2:0] tpg 137
motorola 8-6 MC68HC11PH8 timing system 8 figure 8-2 timer clock divider chains (pll disabled ?vddsyn low) ? 2 6 set q q reset ff2 set q q reset ff1 + baud ? 1, 2, 3, 4,, 8191 sci receiver clock sci transmitter clock e clock prescaler ? 2, 4, 8,16, 32, 64, 128 spr[2:0] spi ? 2 13 pulse accumulator real time interrupt tcnt tof prescaler ? 1, 4, 16, 64 cr[1:0] system reset clear cop timer force cop reset ic/oc ? 4 ? 16 internal bus clock crystal oscillator ? 2 ? 4 lcd clock select ph2 (for cpu, pwm, lcd 8-bit modulus timer a prescaler ? 1, 4, 8, 16 pr[1:0] lcdck clk64 extali o st4xck 0 1 sbr[12:0] a/d and memory) ? 4 (baud rate) ? 2 prescaler ? 1, 2, 4, 8 rtr[1:0] ? 2 18 tpg 138
MC68HC11PH8 motorola 8-7 timing system 8 figure 8-3 capture/compare block diagram + & prescaler ? 1, 4, 8, 16 pr[1:0] st4xck/4 16-bit free running counter tcnt (hi) tcnt (lo) toc1 (lo) & 9 toc1 (hi) 16-bit comparator eq toc2 (lo) toc2 (hi) 16-bit comparator eq toc3 (lo) toc3 (hi) 16-bit comparator eq toc4 (lo) toc4 (hi) 16-bit comparator eq ti4/o5 (lo) ti4/o5 (hi) 16-bit comparator eq tic1 (lo) tic1 (hi) tic2 (lo) tic2 (hi) tic3 (lo) tic3 (hi) 16-bit timer bus 16-bit latch clk 16-bit latch clk 16-bit latch clk 16-bit latch clk oc1f tof toi i4/o5f 8 oc2f oc3f oc4f ic1f ic2f ic3f i4/o5 oc5 ic4 oc1i foc1 bit 7 + & 7 oc2i foc2 + & 6 oc3i foc3 + & 5 oc4i foc4 + & 4 i4/o5i foc5 & ic1i 3 & ic3i 1 & ic2i 2 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 pa6/ oc2/ oc1 pa5/ oc3/ oc1 pa4/ oc4/ oc1 pa3/ oc5/ oc1/ pa2/ ic1 ic4 pa1/ ic2 pa0/ ic3 tflg1 status ?ags tmsk1 interrupt enables port a pin control port a pin actions are controlled by oc1m, oc1d, pactl, tctl1 and tctl2 registers pins/ functions cforc force o/p compare to pulse accumulator note ? ? interrupt requests 1e9 (these are further qualited by the i-bit in the ccr) pa7/ oc1/ pai tpg 139
motorola 8-8 MC68HC11PH8 timing system 8 8.1.3 input capture the input capture function records the time an external event occurs by latching the value of the free-running counter when a selected edge is detected at the associated timer input pin. software can store latched values and use them to compute the periodicity and duration of events. for example, by storing the times of successive edges of an incoming signal, software can determine the period and pulse width of a signal. to measure period, two successive edges of the same polarity are captured. to measure pulse width, two alternate polarity edges are captured. in most cases, input capture edges are asynchronous with respect to the internal timer counter, which is clocked relative to an internal clock (ph2). these asynchronous capture requests are synchronized with ph2 so that latching occurs on the opposite half cycle of ph2 from when the timer counter is being incremented. this synchronization process introduces a delay from when the edge occurs to when the counter value is detected. because these delays cancel out when the time between two edges is being measured, the delay can be ignored. when an input capture is being used with an output compare, there is a similar delay between the actual compare point and when the output pin changes state. the control and status bits that implement the input capture functions are contained in the pactl, tctl2, tmsk1, and tflg1 registers. to con?ure port a bit 3 as an input capture, clear the dda3 bit of the ddra register. note that this bit is cleared out of reset. to enable pa3 as the fourth input capture, set the i4/o5 bit in the pactl register. otherwise, pa3 is con?ured as a ?th output compare out of reset, with bit i4/o5 being cleared. if the dda3 bit is set (con?uring pa3 as an output), and ic4 is enabled, then writes to pa3 cause edges on the pin to result in input captures. writing to ti4/o5 has no effect when the ti4/o5 register is acting as ic4. tpg 140
MC68HC11PH8 motorola 8-9 timing system 8 8.1.3.1 tctl2 ?timer control register 2 use the control bits of this register to program input capture functions to detect a particular edge polarity on the corresponding timer input pin. each of the input capture functions can be independently con?ured to detect rising edges only, falling edges only, any edge (rising or falling), or to disable the input capture function. the input capture functions operate independently of each other and can capture the same tcnt value if the input edges are detected within the same timer count cycle. edgxb and edgxa ?input capture edge control there are four pairs of these bits. each pair is cleared by reset and must be encoded to con?ure the corresponding input capture edge detector circuit. ic4 functions only if the i4/o5 bit in the pactl register is set. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control 2 (tctl2) $0021 edg4b edg4a edg1b edg1a edg2b edg2a edg3b edg3a 0000 0000 edgxb edgxa contguration 0 0 icx disabled 0 1 icx captures on rising edges only 1 0 icx captures on falling edges only 1 1 icx captures on any edge tpg 141
motorola 8-10 MC68HC11PH8 timing system 8 8.1.3.2 tic1?ic3 ?timer input capture registers when an edge has been detected and synchronized, the 16-bit free-running counter value is transferred into the input capture register pair as a single 16-bit parallel transfer. timer counter value captures and timer counter incrementing occur on opposite half-cycles of the phase 2 clock so that the count value is stable whenever a capture occurs. input capture values can be read from a pair of 8-bit read-only registers. a read of the high-order byte of an input capture register pair inhibits a new capture transfer for one bus cycle. if a double-byte read instruction, such as ldd, is used to read the captured value, coherency is assured. when a new input capture occurs immediately after a high-order byte read, transfer is delayed for an additional cycle but the value is not lost. the ticx registers are not affected by reset. 8.1.3.3 ti4/o5 ?timer input capture 4/output compare 5 register use ti4/o5 as either an input capture register or an output compare register, depending on the function chosen for the pa3 pin. to enable it as an input capture pin, set the i4/o5 bit in the pulse accumulator control register (pactl) to logic level one. to use it as an output compare register, set the i4/o5 bit to a logic level zero. refer to section 8.1.8.1. the ti4/o5 register pair resets to ones ($ffff). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer input capture 1 (tic1) high $0010 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) undetned timer input capture 1 (tic1) low $0011 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned timer input capture 2 (tic2) high $0012 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) undetned timer input capture 2 (tic2) low $0013 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned timer input capture 3 (tic3) high $0014 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) undetned timer input capture 3 (tic3) low $0015 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset capture 4/compare 5 (ti4/o5) high $001e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 capture 4/compare 5 (ti4/o5) low $001f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 tpg 142
MC68HC11PH8 motorola 8-11 timing system 8 8.1.4 output compare use the output compare (oc) function to program an action to occur at a speci? time ?when the 16-bit counter reaches a speci?d value. for each of the ?e output compare functions, there is a separate 16-bit compare register and a dedicated 16-bit comparator. the value in the compare register is compared to the value of the free-running counter on every bus cycle. when the compare register matches the counter value, an output compare status ?g is set. the ?g can be used to initiate the automatic actions for that output compare function. to produce a pulse of a speci? duration, write a value to the output compare register that represents the time the leading edge of the pulse is to occur. the output compare circuit is con?ured to set the appropriate output either high or low, depending on the polarity of the pulse being produced. after a match occurs, the output compare register is reprogrammed to change the output pin back to its inactive level at the next match. a value representing the width of the pulse is added to the original value, and then written to the output compare register. because the pin state changes occur at speci? values of the free-running counter, the pulse width can be controlled accurately at the resolution of the free-running counter, independent of software latency. to generate an output signal of a speci? frequency and duty cycle, repeat this pulse-generating procedure. there are four 16-bit read/write output compare registers: toc1, toc2, toc3, and toc4, and the ti4/o5 register, which functions under software control as either ic4 or oc5. each of the oc registers is set to $ffff on reset. a value written to an oc register is compared to the free-running counter value during each e clock cycle. if a match is found, the particular output compare ?g is set in timer interrupt ?g register 1 (tflg1). if that particular interrupt is enabled in the timer interrupt mask register 1 (tmsk1), an interrupt is generated. in addition to an interrupt, a speci?d action can be initiated at one or more timer output pins. for oc[5:2], the pin action is controlled by pairs of bits (omx and olx) in the tctl1 register. the output action is taken on each successful compare, regardless of whether or not the ocxf ?g in the tflg1 register was previously cleared. oc1 is different from the other output compares in that a successful oc1 compare can affect any or all ?e of the oc pins. the oc1 output action taken when a match is found is controlled by two 8-bit registers with three bits unimplemented: the output compare 1 mask register, oc1m, and the output compare 1 data register, oc1d. oc1m speci?s which port a outputs are to be used, and oc1d speci?s what data is placed on these port pins. tpg 143
motorola 8-12 MC68HC11PH8 timing system 8 8.1.4.1 toc1?oc4 ?timer output compare registers all output compare registers are 16-bit read-write. each is initialized to $ffff at reset. if an output compare register is not used for an output compare function, it can be used as a storage location. a write to the high-order byte of an output compare register pair inhibits the output compare function for one bus cycle. this inhibition prevents inappropriate subsequent comparisons. coherency requires a complete 16-bit read or write. however, if coherency is not needed, byte accesses can be used. for output compare functions, write a comparison value to output compare registers toc1?oc4 and ti4/o5. when tcnt value matches the comparison value, speci?d pin actions occur. all tocx register pairs reset to ones ($ffff). 8.1.4.2 cforc ?timer compare force register the cforc register allows forced early compares. foc[1:5] correspond to the ?e output compares. these bits are set for each output compare that is to be forced. the action taken as a result of a forced compare is the same as if there were a match between the ocx register and the free-running counter, except that the corresponding interrupt status ?g bits are not set. the forced channels trigger their programmed pin actions to occur at the next timer count transition after the write to cforc. the cforc bits should not be used on an output compare function that is programmed to toggle its output on a successful compare because a normal compare that occurs immediately before or after the force can result in an undesirable operation. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer output compare 1 (toc1) high $0016 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 1 (toc1) low $0017 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 2 (toc2) high $0018 (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 2 (toc2) low $0019 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 3 (toc3) high $001a (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 3 (toc3) low $001b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 timer output compare 4 (toc4) high $001c (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 1111 1111 timer output compare 4 (toc4) low $001d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer compare force (cforc) $000b foc1 foc2 foc3 foc4 foc5 0 0 0 0000 0000 tpg 144
MC68HC11PH8 motorola 8-13 timing system 8 foc[1:5] ?force output compares 1 (set) a forced output compare action will occur on the speci?d pin. 0 (clear) no action. bits [2:0] ?not implemented; always read zero 8.1.4.3 oc1m ?output compare 1 mask register use oc1m with oc1 to specify the bits of port a that are affected by a successful oc1 compare. the bits of the oc1m register correspond to pa7?a3. oc1m[7:3] ?output compare masks for oc1 1 (set) oc1 is con?ured to control the corresponding pin of port a. 0 (clear) oc1 will not affect the corresponding port a pin. bits [2:0] ?not implemented; always read zero. 8.1.4.4 oc1d ?output compare 1 data register use this register with oc1 to specify the data that is to be written to the affected pin of port a after a successful oc1 compare. when a successful oc1 compare occurs, a data bit in oc1d is written to the corresponding pin of port a for each bit that is set in oc1m. oc1d[7:3] ?output compare data for oc1 if oc1mx is set, data in oc1dx is output to port a pin x on successful oc1 compares. bits [2:0] ?not implemented; always read zero address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset output compare 1 mask (oc1m) $000c oc1m7 oc1m6 oc1m5 oc1m4 oc1m3 0 0 0 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset output compare 1 data (oc1d) $000d oc1d7 oc1d6 oc1d5 oc1d4 oc1d3 0 0 0 0000 0000 tpg 145
motorola 8-14 MC68HC11PH8 timing system 8 8.1.4.5 tcnt ?timer counter register the 16-bit read-only tcnt register contains the prescaled value of the 16-bit timer. a full counter read addresses the more signi?ant byte (msb) ?st. a read of this address causes the less signi?ant byte (lsb) to be latched into a buffer for the next cpu cycle so that a double-byte read returns the full 16-bit state of the counter at the time of the msb read cycle. tcnt resets to $0000. 8.1.4.6 tctl1 ?timer control register 1 the bits of this register specify the action taken as a result of a successful ocx compare. om[2:5] ?output mode ol[2:5] ?output level these control bit pairs are encoded to specify the action taken after a successful ocx compare. oc5 functions only if the i4/o5 bit in the pactl register is clear. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer count (tcnt) high $000e (bit 15) (14) (13) (12) (11) (10) (9) (bit 8) 0000 0000 timer count (tcnt) low $000f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer control 1 (tctl1) $0020 om2 ol2 om3 ol3 om4 ol4 om5 ol5 0000 0000 omx olx action taken on successful compare 0 0 timer disconnected from ocx pin logic 0 1 toggle ocx output line 1 0 clear ocx output line to 0 1 1 set ocx output line to 1 tpg 146
MC68HC11PH8 motorola 8-15 timing system 8 8.1.4.7 tmsk1 ?timer interrupt mask register 1 use this 8-bit register to enable or inhibit the timer input capture and output compare interrupts. note: bits in tmsk1 correspond bit for bit with ?g bits in tflg1. ones in tmsk1 enable the corresponding interrupt sources. oc1i?c4i ?output compare x interrupt enable 1 (set) ocx interrupt is enabled. 0 (clear) ocx interrupt is disabled. if the ocxi enable bit is set when the ocxf ?g bit is set, a hardware interrupt sequence is requested. i4/o5i ?input capture 4/output compare 5 interrupt enable 1 (set) ic4/oc5 interrupt is enabled. 0 (clear) ic4/oc5 interrupt is disabled. when i4/o5 in pactl is set, i4/o5i is the input capture 4 interrupt enable bit. when i4/o5 in pactl is zero, i4/o5i is the output compare 5 interrupt enable bit. ic1i?c3i ?input capture x interrupt enable 1 (set) icx interrupt is enabled. 0 (clear) icx interrupt is disabled. if the icxi enable bit is set when the icxf ?g bit is set, a hardware interrupt sequence is requested. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt mask 1 (tmsk1) $0022 oc1i oc2i oc3i oc4i i4/o5i ic1i ic2i ic3i 0000 0000 tpg 147
motorola 8-16 MC68HC11PH8 timing system 8 8.1.4.8 tflg1 ?timer interrupt ?g register 1 bits in this register indicate when timer system events have occurred. coupled with the bits of tmsk1, the bits of tflg1 allow the timer subsystem to operate in either a polled or interrupt driven system. clear ?gs by writing a one to the corresponding bit position(s). note: bits in tflg1 correspond bit for bit with ?g bits in tmsk1. ones in tmsk1 enable the corresponding interrupt sources. oc1f?c4f ?output compare x ?g 1 (set) counter has reached the preset output compare x value. 0 (clear) counter has not reached the preset output compare x value. these ?gs are set each time the counter matches the corresponding output compare x values. i4/o5f ?input capture 4/output compare 5 ?g set by ic4 or oc5, depending on the function enabled by i4/o5 bit in pactl ic1f?c3f ?input capture x ?g 1 (set) selected edge has been detected on corresponding port pin. 0 (clear) selected edge has not been detected on corresponding port pin. these ?gs are set each time a selected active edge is detected on the icx input line address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?ag 1 (tflg1) $0023 oc1f oc2f oc3f oc4f i4/o5f ic1f ic2f ic3f 0000 0000 tpg 148
MC68HC11PH8 motorola 8-17 timing system 8 8.1.4.9 tmsk2 ?timer interrupt mask register 2 use this 8-bit register to enable or inhibit timer over?w and real-time interrupts. the timer prescaler control bits are included in this register. note: bits in tmsk2 correspond bit for bit with ?g bits in tflg2. ones in tmsk2 enable the corresponding interrupt sources. toi ?timer over?w interrupt enable 1 (set) timer over?w interrupt requested when tof is set. 0 (clear) tof interrupts disabled. rtii ?real-time interrupt enable (refer to section 8.1.5) 1 (set) real time interrupt requested when rtif is set. 0 (clear) real time interrupts disabled. paovi ?pulse accumulator over?w interrupt enable (refer to section 8.1.8) paii ?pulse accumulator input edge interrupt enable (refer to section 8.1.8) bits [3, 2] ?not implemented; always read zero. pr[1:0] ?timer prescaler select these bits are used to select the prescaler divide-by ratio. in normal modes, pr[1:0] can only be written once, and the write must be within 64 cycles after reset. see table 8-1 for speci? timing values. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 pr[1:0] prescaler 0 0 1 0 1 4 1 0 8 1 1 16 tpg 149
motorola 8-18 MC68HC11PH8 timing system 8 8.1.4.10 tflg2 ?timer interrupt ?g register 2 bits in this register indicate when certain timer system events have occurred. coupled with the four high-order bits of tmsk2, the bits of tflg2 allow the timer subsystem to operate in either a polled or interrupt driven system. clear ?gs by writing a one to the corresponding bit position(s). note: bits in tflg2 correspond bit for bit with ?g bits in tmsk2. ones in tmsk2 enable the corresponding interrupt sources. tof ?timer over?w interrupt ?g 1 (set) tcnt has over?wed from $ffff to $0000. 0 (clear) no timer over?w has occurred. rtif ?real time (periodic) interrupt ?g (refer to section 8.1.5) 1 (set) rti period has elapsed. 0 (clear) rti ?g has been cleared. paovf ?pulse accumulator over?w interrupt ?g (refer to section 8.1.8) paif ?pulse accumulator input edge interrupt ?g (refer to section 8.1.8.) bits [3:0] ?not implemented; always read zero address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?ag 2 (tflg2) $0025 tof rtif paovf paif0000 0000 0000 tpg 150
MC68HC11PH8 motorola 8-19 timing system 8 8.1.5 real-time interrupt the real-time interrupt (rti) feature, used to generate hardware interrupts at a ?ed periodic rate, has two possible clock sources. when the pll clock generation is not used (vddsyn low), the rti function is clocked by the 16-bit free-running counter (st4xck/2 15 ). when the pll clock generation is used (vddsyn high), the rti clock source is the under?w of the 8-bit modulus timer a (clk64). this ensures that the rti interrupt rate is unaffected by changes made to the bus speed by the pll circuit. see figure 8-1 and figure 8-2. the rti clock rate is controlled and con?ured by two bits (rtr1 and rtr0) in the pulse accumulator control (pactl) register. the different rates available are a product of the source frequency and the value of bits rtr[1:0]. if vddsyn is low, the source frequency, st4xck/2 15 , can be divided by 1,2,4 or 8. if vddsyn is high, the source frequency, clk64, can be divided by 1,2,4 or 64. refer to table 8-2 and table 8-3 which show examples of periodic real-time interrupt rates. the rtii bit in the tmsk2 register enables the interrupt capability. note: the values in table 8-3 assume that the 8-bit modulus timer is loaded to give an extali/2 8 prescaler value. other prescaler values are possible, in the range extali/4 to extali/4080 (see section 8.3.1). either clock source causes the time between successive rti timeouts to be a constant that is independent of the software latency associated with ?g clearing and service. for this reason, an rti period starts from the previous timeout, not from when rtif is cleared. every timeout causes the rtif bit in tflg2 to be set, and if rtii is set, an interrupt request is generated. after reset, one entire rti period elapses before the rtif ?g is set for the ?st time. refer to the tmsk2, tflg2, and pactl registers. table 8-2 rti periodic rates (pll disabled) rtr[1:0] st4xck = 12mhz st4xck = 8mhz st4xck = 4mhz st4xck = xmhz 0 0 0 1 1 0 1 1 2.731ms 5.461ms 10.923ms 21.845ms 4.096ms 8.192ms 16.384ms 32.768ms 8.192ms 16.384ms 32.768ms 65.536ms 2 15 /st4xck 2 16 /st4xck 2 17 /st4xck 2 18 /st4xck table 8-3 rti periodic rates (pll enabled) rtr[1:0] extali = 640khz extali = 32.768khz extali = 32khz extali = xkhz 0 0 0 1 1 0 1 1 0.4ms 0.8ms 1.6ms 25.6ms 7.81ms 15.63ms 31.25ms 500ms 8.0ms 16.0ms 32.0ms 512ms 2 8 /extali 2 9 /extali 2 10 /extali 2 14 /extali tpg 151
motorola 8-20 MC68HC11PH8 timing system 8 8.1.5.1 tmsk2 ?timer interrupt mask register 2 this register contains the real-time interrupt enable bit. note: bits in tmsk2 correspond bit for bit with ?g bits in tflg2. ones in tmsk2 enable the corresponding interrupt sources. toi ?timer over?w interrupt enable (refer to section 8.1.4.9) 1 (set) timer over?w interrupt requested when tof is set. 0 (clear) tof interrupts disabled. rtii ?real-time interrupt enable 1 (set) real time interrupt requested when rtif is set. 0 (clear) real time interrupts disabled. paovi ?pulse accumulator over?w interrupt enable (refer to section 8.1.8) paii ?pulse accumulator input edge (refer to section 8.1.8) bits[3, 2] ?not implemented; always reads zero pr[1, 0] ?timer prescaler select (refer to section 8.1.4.9) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 tpg 152
MC68HC11PH8 motorola 8-21 timing system 8 8.1.5.2 tflg2 ?timer interrupt ?g register 2 bits of this register indicate the occurrence of timer system events. coupled with the four high-order bits of tmsk2, the bits of tflg2 allow the timer subsystem to operate in either a polled or interrupt driven system. clear ?gs by writing a one to the corresponding bit position(s). note: bits in tflg2 correspond bit for bit with ?g bits in tmsk2. ones in tmsk2 enable the corresponding interrupt sources. tof ?timer over?w interrupt ?g (refer to section 8.1.4.10) 1 (set) tcnt has over?wed from $ffff to $0000. 0 (clear) no timer over?w has occurred. rtif ?real-time interrupt ?g 1 (set) rti period has elapsed. 0 (clear) rti ?g has been cleared. the rtif status bit is automatically set to one at the end of every rti period. paovf ?pulse accumulator over?w interrupt ?g (refer to section 8.1.8) paif ?pulse accumulator input edge interrupt ?g (refer to section 8.1.8) bits [3:0] ?not implemented; always read zero address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?ag 2 (tflg2) $0025 tof rtif paovf paif0000 0000 0000 tpg 153
motorola 8-22 MC68HC11PH8 timing system 8 8.1.5.3 pactl ?pulse accumulator control register bits rtr[1:0] of this register select the rate for the rti system. the remaining bits control the pulse accumulator and ic4/oc5 functions. bits [7, 3] ?not implemented; always read zero paen ?pulse accumulator system enable (refer to section 8.1.8) 1 (set) pulse accumulator enabled. 0 (clear) pulse accumulator disabled. pamod ?pulse accumulator mode (refer to section 8.1.8) 1 (set) gated time accumulation mode. 0 (clear) event counter mode. pedge ?pulse accumulator edge control (refer to section 8.1.8) this bit has different meanings depending on the state of the pamod bit. i4/o5 ?input capture 4/output compare 5 (refer to section 8.1.8) 1 (set) input capture 4 function is enabled (no oc5). 0 (clear) output compare 5 function is enabled (no ic4). rtr[1:0] ?rti interrupt rate select these two bits determine the rate at which the rti system requests interrupts. the rti system is driven either by clk64 or by an st4xck/2 15 clock rate that is compensated so it is independent of the timer prescaler. these two control bits select an additional division factor. refer to table 8-2 and table 8-3. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse accumulator control (pactl) $0026 0 paen pamod pedge 0 i4/o5 rtr1 rtr0 0000 0000 tpg 154
MC68HC11PH8 motorola 8-23 timing system 8 8.1.6 computer operating properly watchdog function there are two possible clock sources for the cop function (see figure 8-1 and figure 8-2). when pll clock generation is not used (vddsyn low), the clocking chain for the cop function is tapped off from the main timer divider chain (st4xck/2 17 ). when the pll clock generation is used (vddsyn high), the cop function is clocked by the under?w of the 8-bit modulus timer a (clk64/4). the cr[1:0] bits in the option register and the nocop bit in the config register control and con?ure the cop function. one additional register, coprst, is used to arm and clear the cop watchdog reset system. refer to section 10 for a more detailed discussion of the cop function. 8.1.7 lcd module there are three possible clock sources for the lcd module, under control of the lcdck bit and depending on the state of vddsyn. when lcdck = 0, the lcd module is clocked by the output of 8-bit modulus timer a (clk64). when lcdck = 1, the lcd module is clocked by clk64/8 if pll clock generation is used (vddsyn high), and by st4xck/2 18 if pll clock generation is not used (vddsyn low). refer to figure 8-1, figure 8-2 and section 2.12. 8.1.8 pulse accumulator the MC68HC11PH8 has an 8-bit counter that can be con?ured to operate either as a simple event counter, or for gated time accumulation, depending on the state of the pamod bit in the pactl register. refer to the pulse accumulator block diagram, figure 8-4. in the event counting mode, the 8-bit counter is clocked to increasing values by an external pin. the maximum clocking rate for the external event counting mode is the e clock divided by two. in gated time accumulation mode, a free-running st4xck/2 8 signal drives the 8-bit counter, but only while the external pai pin is activated. refer to table 8-4. the pulse accumulator counter can be read or written at any time. (1) crystal frequency values are only valid if the pll is not active. table 8-4 pulse accumulator timing crystal frequency (1) st4xck/4 clock cycle time 2 8 /st4xck pacnt over?ow 4.0 mhz 1.0 mhz 1000 ns 64 m s 16.384 ms 8.0 mhz 2.0 mhz 500 ns 32 m s 8.192 ms 12.0 mhz 3.0 mhz 333 ns 21.33 m s 5.461 ms 16.0 mhz 4.0 mhz 250 ns 16.0 m s 4.096 ms tpg 155
motorola 8-24 MC68HC11PH8 timing system 8 pulse accumulator control bits are located within the pactl, tmsk2 and tflg2 registers, as described in the following paragraphs. figure 8-4 pulse accumulator block diagram tof 0 paovf paif 0 0 0 tflg2 rtif toi rtii 0 paii 0 pr1 pr0 tmsk2 0 paen 0 pamod pactl paovi rtr1 rtr0 pedge i4/o5 & & pacnt 1 2 pa7/ oc1/ pai 2:1 mux input buffer and edge detector output buffer & from ddra7 from oc1 st4xck/2 8 clock (from main timer) over?ow enable clock interrupt requests internal data bus disable ?ag setting tpg 156
MC68HC11PH8 motorola 8-25 timing system 8 8.1.8.1 pactl ?pulse accumulator control register four of this registers bits control an 8-bit pulse accumulator system. another bit enables either the oc5 function or the ic4 function, while two other bits select the rate for the real-time interrupt system. bits [7, 3] ?not implemented; always read zero paen ?pulse accumulator system enable 1 (set) pulse accumulator enabled. 0 (clear) pulse accumulator disabled. pamod ?pulse accumulator mode 1 (set) gated time accumulation mode. 0 (clear) event counter mode. pedge ?pulse accumulator edge control this bit has different meanings depending on the state of the pamod bit, as shown: i4/o5 ?input capture 4/output compare 5 1 (set) input capture 4 function is enabled (no oc5). 0 (clear) output compare 5 function is enabled (no ic4) rtr[1:0] ?rti interrupt rate selects (refer to section 8.1.5) address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse accumulator control (pactl) $0026 0 paen pamod pedge 0 i4/o5 rtr1 rtr0 0000 0000 pamod pedge action of clock 0 0 pai falling edge increments the counter. 0 1 pai rising edge increments the counter. 1 0 a zero on pai inhibits counting. 1 1 a one on pai inhibits counting. tpg 157
motorola 8-26 MC68HC11PH8 timing system 8 8.1.8.2 pacnt ?pulse accumulator count register this 8-bit read/write register contains the count of external input events at the pai input, or the accumulated count. in gated time accumulation mode, pacnt is readable even if pai is not active. the counter is not affected by reset and can be read or written at any time. counting is synchronized to the internal ph2 clock so that incrementing and reading occur during opposite half cycles. 8.1.8.3 pulse accumulator status and interrupt bits the pulse accumulator control bits, paovi and paii, paovf and paif are located within timer registers tmsk2 and tflg2. 8.1.8.4 tmsk2 ?timer interrupt mask 2 register 8.1.8.5 tflg2 ?timer interrupt ?g 2 register paovi and paovf ?pulse accumulator interrupt enable and over?w ?g the paovf status bit is set each time the pulse accumulator count rolls over from $ff to $00. to clear this status bit, write a one in the corresponding data bit position (bit 5) of the tflg2 register. the paovi control bit allows the pulse accumulator over?w to be con?ured for polled or interrupt-driven operation and does not affect the state of paovf. when paovi is zero, pulse accumulator over?w interrupts are inhibited, and the system operates in a polled mode, which requires that paovf be polled by user software to determine when an over?w has occurred. when the paovi control bit is set, a hardware interrupt request is generated each time paovf is set. before leaving the interrupt service routine, software must clear paovf. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse accumulator count (pacnt) $0027 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt mask 2 (tmsk2) $0024 toi rtii paovi paii 0 0 pr1 pr0 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset timer interrupt ?ag 2 (tflg2) $0025 tof rtifpaovfpaif0000 0000 0000 tpg 158
MC68HC11PH8 motorola 8-27 timing system 8 paii and paif ?pulse accumulator input edge interrupt enable and ?g the paif status bit is automatically set each time a selected edge is detected at the pa7/pai/oc1 pin. to clear this status bit, write to the tflg2 register with a one in the corresponding data bit position (bit 4). the paii control bit allows the pulse accumulator input edge detect to be con?ured for polled or interrupt-driven operation but does not affect setting or clearing the paif bit. when paii is zero, pulse accumulator input interrupts are inhibited, and the system operates in a polled mode. in this mode, the paif bit must be polled by user software to determine when an edge has occurred. when the paii control bit is set, a hardware interrupt request is generated each time paif is set. before leaving the interrupt service routine, software must clear paif. 8.2 pulse-width modulation (pwm) timer the pwm timer subsystem provides up to four 8-bit pulse-width modulated waveforms on the port h pins. channel pairs can be concatenated to create 16-bit pwm outputs. three clock sources (a, b, and s) and a ?xible clock select scheme give the pwm a wide range of frequencies. four control registers con?ure the pwm outputs ?pwclk, pwpol, pwscal, and pwen. the pwclk register selects the prescale value for the pwm clock sources and enables the 16-bit pwm functions. the pwpol register determines each channels polarity and selects the clock source for each channel. the pwscal register derives a user-scaled clock based on the a clock source, and the pwen register enables the pwm channels. each channel also has a separate 8-bit counter, period register, and duty cycle register. the period and duty cycle registers are double buffered so that if they are changed while the channel is enabled, the change does not take effect until the counter rolls over or the channel is disabled. a new period or duty cycle can be forced into effect immediately by writing to the period or duty cycle register and then writing to the counter. with pwms con?ured for 8-bit mode and e equal to 4mhz, pwm signals can be produced from 40 khz (1% duty cycle resolution) to less than 10 cycles per second (approximately 0.4% duty cycle resolution). by con?uring the pwms for 16-bit mode with e equal to 4mhz, pwm periods greater than one minute are possible. in 16-bit mode, duty cycle resolution of up to 15 parts per million can be achieved (at a pwm frequency of 60hz). in the same system, a pwm frequency of 1khz corresponds to a duty cycle resolution of 0.025%. pin alternate function ph0 pw1 ph1 pw2 ph2 pw3 ph3 pw4 tpg 159
motorola 8-28 MC68HC11PH8 timing system 8 8.2.1 pwm timer block diagram figure 8-5 shows the block diagram of the pwm timer subsystem. three different clock sources are selectable and provide inputs to the control registers. each of the four channels has a counter, a period register, and a duty register. the waveform output is the result of a match between the period register (pwperx) and the value in the counter (pwcntx). the duty register (pwdtyx) changes the state of the output during the period to determine the duty cycle. 8.2.2 pwclk ?pwm clock prescaler and 16-bit select register this register contains bits for selecting the 16-bit pwm options and the prescaler values for the clocks. 8.2.2.1 16-bit pwm function the pwclk register contains two control bits, each of which is used to concatenate a pair of pwm channels into one 16-bit channel. channels 3 and 4 are concatenated with the con34 bit, and channels 1 and 2 are concatenated with the con12 bit. when the 16-bit concatenated mode is selected, the clock source is determined by the low order channel. channel 2 is the low order channel when channels 1 and 2 are concatenated. channel 4 is the low order channel when channels 3 and 4 are concatenated. the pins associated with channels 1 and 3 can be used for general-purpose i/o when 16-bit pwm mode is selected. channel 1 registers are the high order byte of the double-byte channel when channels 1 and 2 are concatenated. channel 3 registers are the high order byte of the double-byte channel when channels 3 and 4 are concatenated. reads of the high order byte cause the low order byte to be latched for one cycle to guarantee that double byte reads are accurate. writes to the low byte of the counter cause reset of the entire counter. writes to the upper bytes of the counter have no effect. con34 ?concatenate channels 3 and 4 1 (set) channels 3 and 4 are concatenated into one 16-bit pwm channel. 0 (clear) channels 3 and 4 are separate 8-bit pwms. when concatenated, channel 3 is the high-order byte and the channel 4 pin (ph3) is the output. con12 ?concatenate channels 1 and 2 1 (set) channels 1 and 2 are concatenated into one 16-bit pwm channel. 0 (clear) channels 1 and 2 are separate 8-bit pwms. when concatenated, channel 1 is the high-order byte and the channel 2 pin (ph1) is the output. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width clock select (pwclk) $0060 con34 con12 pcka2 pcka1 0 pckb3 pckb2 pckb1 0000 0000 tpg 160
MC68HC11PH8 motorola 8-29 timing system 8 figure 8-5 pwm timer block diagram mcu e clock 8-bit comparator eq pwscal divider prescale select ? 1, 2, 4, 8, 16, 32, 64, 128 prescale select ? 1, 2, 4, 8 pckb1 pckb2 pckb3 pcka2 pcka1 8-bit counter ? 2 clock select clock select pwen3 pwen4 con34 clock b clock a clock s con12 pwen1 pwen2 pclk4 pclk3 pclk2 pclk1 reset 4 8 8-bit comparator eq ph0/ pw1 pwdty1 bit 0 bit 1 bit 2 bit 3 sq q r mux 8-bit comparator eq pwper1 8-bit comparator eq pwdty2 8-bit comparator eq pwper2 carry sq q r mux 16-bit pwm control reset reset ppol2 ppol1 con12 8-bit comparator eq pwdty3 sq q r mux 8-bit comparator eq pwper3 8-bit comparator eq pwdty4 8-bit comparator eq pwper4 carry sq q r mux 16-bit pwm control reset reset ppol4 ppol3 con34 port h pin control ph1/ pw2 ph2/ pw3 ph3/ pw4 pwcnt3 pwcnt4 pwcnt2 pwcnt1 cnt1 cnt2 cnt3 cnt4 tpg 161
motorola 8-30 MC68HC11PH8 timing system 8 8.2.2.2 clock prescaler selection the three available clocks are clock a, clock b, and clock s (scaled). clock a can be software selected to be e, e/2, e/4, or e/8. clock b can be software selected to be e, e/2, e/4,..., e/128. the scaled clock (clock s) uses clock a as an input and divides it with a reloadable counter. the rates available are software selectable to be clock a/2, down to clock a /512. the clock source portion of the block diagram shows the three clock sources and how the scaled clock is created. clock a is an input to an 8-bit counter which is then compared to a user programmable scale value. when they match, this circuit has an output that is divided by two and the counter is reset. each pwm timer channel can be driven by one of two clocks. refer to figure 8-5. pcka[2:1] ?prescaler for clock a determines the frequency of clock a. refer to table 8-5. bit 3 ? not implemented; always reads zero pckb[3:1] ?prescaler for clock b determines the frequency of clock b. refer to table 8-5. table 8-5 clock a and clock b prescalers pcka[2:1] clock a pckb[3:1] clock b 0 0 e 0 0 0 e 0 1 e/2 0 0 1 e/2 1 0 e/4 0 1 0 e/4 1 1 e/8 0 1 1 e/8 1 0 0 e/16 1 0 1 e/32 1 1 0 e/64 1 1 1 e/128 tpg 162
MC68HC11PH8 motorola 8-31 timing system 8 8.2.3 pwpol ?pwm timer polarity & clock source select register pclk[4:3] ?pulse width channel 4/3 clock select 1 (set) clock s is source. 0 (clear) clock b is source. pclk[2:1] ?pulse width channel 2/1 clock select 1 (set) clock s is source. 0 (clear) clock a is source. ppol[4:1] ?pulse width channel x polarity 1 (set) pwm channel x output is high at the beginning of the clock cycle and goes low when duty count is reached. 0 (clear) pwm channel x output is low at the beginning of the clock cycle and goes high when duty count is reached. each channel has a polarity bit that allows a cycle to start with either a high or a low level. this is shown on the block diagram, figure 8-5, as a selection of either the q output or the q output of the pwm output ?p ?p. when one of the bits in the pwpol register is set, the associated pwm channel output is high at the beginning of the clock cycle, then goes low when the duty count is reached. 8.2.4 pwscal ?pwm timer prescaler register scaled clock s is generated by dividing clock a by the value in pwscal, then dividing the result by two. if pwscal = $00, clock a is divided by 256, then divided by two to generate clock s. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width polarity select (pwpol) $0061 pclk4 pclk3 pclk2 pclk1 ppol4 ppol3 ppol2 ppol1 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width scale (pwscal) $0062 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 tpg 163
motorola 8-32 MC68HC11PH8 timing system 8 8.2.5 pwen ?pwm timer enable register each timer has an enable bit to start its waveform output. writing any of these pwenx bits to one causes the associated port line to become an output regardless of the state of the associated ddr bit. this does not change the state of the ddr bit and when pwenx returns to zero the ddr bit again controls i/o state. on the front end of the pwm timer the clock is connected to the pwm circuit by the pwenx enable bit being high. there is a synchronizing circuit to guarantee that the clock will only be enabled or disabled at an edge. pwen contains 4 pwm enable bits ?one for each channel. when an enable bit is set to one, the pulse modulated signal becomes available at the associated port pin. tpwsl ?pwm scaled clock test bit (test mode only) 1 (set) clock s output to pwscal register (test only). 0 (clear) normal operation. when tpwsl is one, clock s from the pwm timer is output to pwscal register. normal writing to the pwscal register still functions. discp ?disable compare scaled e clock (test mode only) 1 (set) match of period does not reset associated count register (test only). 0 (clear) normal operation. bits [5:4] ? not implemented; always read zero pwen[4:1] ?pulse width channels 4? 1 (set) channel enabled on the associated port pin. 0 (clear) channel disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width enable (pwen) $0063 tpwsl discp 0 0 pwen4 pwen3 pwen2 pwen1 0000 0000 tpg 164
MC68HC11PH8 motorola 8-33 timing system 8 8.2.6 pwcnt1? ?pwm timer counter registers 1 to 4 each channel has its own counter which can be read at any time without affecting the count or the operation of the pwm channel. writing to a counter causes it to be reset to $00; this is generally done before the counter is enabled. a counter may also be written to whilst it is enabled; this may cause a truncated pwm period. 8.2.7 pwper1? ?pwm timer period registers 1 to 4 there is one period register for each channel. the value in this register determines the period of the associated pwm timer channel. pwperx is connected internally to a buffer which compares directly with the counter register. the period value in pwperx is loaded into the buffer when the counter is cleared by the termination of the previous period or by a write to the counter. this register can be written at any time, and the written value will take effect from the start of the next pwm timer cycle. reads of this register return the most recent value written. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width count 1 (pwcnt1) $0064 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 2 (pwcnt2) $0065 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 3 (pwcnt3) $0066 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 pulse width count 4 (pwcnt4) $0067 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 0000 0000 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width period 1 (pwper1) $0068 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width period 2 (pwper2) $0069 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width period 3 (pwper3) $006a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width period 4 (pwper4) $006b (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 tpg 165
motorola 8-34 MC68HC11PH8 timing system 8 8.2.8 pwdty1? ?pwm timer duty cycle registers 1 to 4 there is one duty register for each channel. the value in this register determines the duty cycle of the associated pwm timer channel. pwdtyx is compared to the counter contents and if they are equal, a match occurs and the output goes to the state de?ed by the associated polarity bit. if the register is written while the channel is enabled, then the new value is held in a buffer until the counter rolls over or the channel is disabled. reads of this register return the most recent value written. note: if pwdtyx 3 pwperx then there will be no change of state due to the duty cycle value. in addition, if the duty register is set to $00, then the output will always be in the state which would normally be result from the duty change of state (see also section 8.2.9). 8.2.9 boundary cases the following boundary conditions apply to the values stored in the pwdtyx and pwperx registers and the ppolx bits: if pwdtyx = $00, pwperx > $00 and ppolx = 0 then the output is always high. if pwdtyx = $00, pwperx > $00 and ppolx = 1 then the output is always low. if pwdtyx 3 pwperx and ppolx = 0 then the output is always low. if pwdtyx 3 pwperx and ppolx = 1 then the output is always high. if pwperx = $00 and ppolx = 0 then the output is always low. if pwperx = $00 and ppolx = 1 then the output is always high. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset pulse width duty 1 (pwdty1) $006c (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 2 (pwdty2) $006d (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 3 (pwdty3) $006e (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 pulse width duty 4 (pwdty4) $006f (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) 1111 1111 figure 8-6 pwm duty cycle pwmx pwperx pwdtyx tpg 166
MC68HC11PH8 motorola 8-35 timing system 8 8.3 8-bit modulus timers the MC68HC11PH8 has three 8-bit modulus timers: a, b and c. these timers can generate a wide range of low-frequency, periodic interrupts. in addition, timer a may be used as a clock source for the lcd segments, the cop watchdog system and the real time interrupt (rti), in applications using pll clock generation. each modulus timer consists of an 8-bit down-counter, an 8-bit modulus register and a load mechanism. only the 8-bit modulus register may be written to in software. each timer is con?ured by an associated control register that enables and ?gs interrupts, and selects the clock source for the down-counter. figure 8-7 provides a block diagram of the modulus timers. 8.3.1 modulus timer operation the down-counter in each timer contains a value which is decremented at a preselected clock rate. when this counter value reaches $00 (?nder?w?, an output pulse is generated and, if enabled, a hardware interrupt is requested. at this point, a new value is loaded into the down-counter from the modulus register; at the next clock, the counter will contain this value minus one. note: for all three timers, modulus register values of $00 or $01 should be avoided. because modulus timer a is used to clock the cop monitor and cannot be stopped, the loading mechanism on modulus timer a is inhibited for values of $00 or $01; at under?w, the counter will roll over from $00 to $ff and continue decrementing. the frequency that is output from the timer is equal to the clock frequency divided by the value in the 8-bit modulus register; a modulus register value of n generates a modulus timer under?w every n input clocks. therefore, the modulus timer can divide an input frequency by any value from 2 to 255. in addition, the timer a clock output is further divided by two to give the clk64 signal. there are several software-selectable input clocks for the modulus timers (see section 8.3.2 and figure 8-7). for example, the modulus timer a clock source can be extali, extali/4 or extali/8. consequently, clk64 can vary in frequency from extali/4 (extali ? 2 ? 2) to extali/4080 (extali/8 ? 255 ? 2). the following table provides an example of how to obtain a 64hz frequency from various extali values, using timer a. extali modulus timer a input clock modulus register output 32khz extali $fa 64hz 32.768khz extali/4 $40 64hz 38.4khz extali/4 $46 64hz tpg 167
motorola 8-36 MC68HC11PH8 timing system 8 figure 8-7 8-bit modulus timer system 8-bit down-counter t8bdr ph7 & clock select t8bcr + 8-bit down-counter t8adr clock select t8acr 8-bit down-counter t8cdr clock select t8ccr + under?ow detect under?ow detect under?ow detect t8ai t8af 0 0 csa1 csa2 0 csa0 t8bi t8bf 0 0 csb1 csb2 prb csb0 t8ci t8cf 0 0 csc1 csc2 prc csc0 ph6 extali extali/4 extali/8 & stop extali extali/4 extali/8 & + stop extali extali/4 extali/8 load clock load load clock clock modulus interrupt data bus ? 2 clk64 timer a output clock timer b output clock timer c output clock timer a output clock data bus data bus data bus data bus data bus data bus data bus data bus timer request timer a timer b timer c tpg 168
MC68HC11PH8 motorola 8-37 timing system 8 the modulus register can be written to at any time without affecting the down-counter; care must be taken by the programmer to ensure that a new value is written to the modulus register before the down-counter reaches $00, unless the previous value is to be reloaded. a read of the modulus register with the timer running will access a latched value of the down-counter. this latch guarantees a stable value during the read and is updated with each timer clock. to determine the value in the modulus register itself (for timers b and c), the timer must be stopped by the appropriate clock selection (see section 8.3.2), then a one must be written to the preset bit in the control register. the down-counter now contains the modulus register value. note: because it is used to clock the cop watchdog in applications using pll clock generation, timer a cannot be stopped (therefore, the value in modulus register a cannot be determined). note: the timer preset bits only have an effect if the timer is stopped under hardware control (timers b and c only). the recommended procedure for con?uring timers b and c is as follows: 1) stop the timer by writing %000 to the relevant clock select control bits. 2) set the modulus register by writing the required value to the timer data register. 3) write a one to the timer preset bit. 4) select the desired clock source to start the counter decrementing. 8.3.2 clock rate selection a number of clock rates can be selected in software for each of the three modulus timers. the selection is controlled by bits 0-2 in the timer control register, as shown in the tables below. timer a may be used as a prescaler for timers b and c (see figure 8-7). similarly timer b may be used as a prescaler for timer c, and vice versa. warning: selecting extali as a clock source when the pll function is not used, i.e. when the bus frequency is extali/4, could lead to read or write errors in the timer registers. table 8-6 modulus timers clock sources csa[2:0] timer a clock source csb[2:0] timer b clock source csc[2:0] timer c clock source 0 0 0 extali/8 0 0 0 stopped 0 0 0 stopped 0 0 1 extali 0 0 1 extali 0 0 1 extali 0 1 0 extali/4 0 1 0 extali/4 0 1 0 extali /4 0 1 1 extali/8 0 1 1 extali/8 0 1 1 extali /8 1 0 0 extali/8 1 0 0 timer a under?ow 1 0 0 timer a under?ow 1 0 1 extali/8 1 0 1 timer c under?ow 1 0 1 timer b under?ow 1 1 0 extali/8 1 1 0 rising edge ph7 1 1 0 rising edge ph6 1 1 1 extali/8 1 1 1 stopped 1 1 1 stopped tpg 169
motorola 8-38 MC68HC11PH8 timing system 8 8.3.2.1 t8adr ?8-bit modulus timer a data register this 8-bit register contains the value that will be loaded into the timer a down-counter on the next under?w. at reset, the timer a clock source is the extali clock divided by 8, and the modulus register is initialized to its highest value. because timer a is used to clock the cop watchdog in applications using the pll clock generation, it is not possible to stop timer a. for the same reason, a write of values $00 or $01 to this register will not be loaded from the modulus register to the counter. 8.3.2.2 t8acr ?8-bit modulus timer a control register t8ai ?8-bit timer a interrupt enable 1 (set) hardware interrupt requested when t8af ?g set. 0 (clear) interrupt disabled. when set, an 8-bit modulus timer interrupt occurs when the timer reaches $00. at this time the timer counter is loaded with the value stored in t8adr and the 8-bit counter will continue to count down at the selected clock rate. t8af ?8-bit timer a under?w ?g set when 8-bit modulus timer a reaches $00. an interrupt is generated if enabled by t8ai. this bit is cleared by a write to the t8acr register with t8af set . bits [5:3] ?not implemented; always read zero csa[2:0] ?8-bit timer a clock rate these bits select the timer a clock, as shown in table 8-6. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset 8-bit modulus timer a data (t8adr) $0059 (bit 7) (6) (5) (4) (3) (2) (1) (0) 1111 1111 address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset 8-bit modulus timer a control (t8acr) $005d t8ai t8af 0 0 0 csa2 csa1 csa0 0000 0000 tpg 170
MC68HC11PH8 motorola 8-39 timing system 8 8.3.2.3 t8bdr ?8-bit modulus timer b data register this 8-bit register contains the value that will be loaded into the timer b down-counter at the next under?w. at reset, timer b is stopped and the state of the modulus register is indeterminate. 8.3.2.4 t8bcr ?8-bit modulus timer b control register t8bi ?8-bit timer b interrupt enable 1 (set) hardware interrupt requested when t8bf ?g set. 0 (clear) interrupt disabled. when set, an 8-bit modulus timer interrupt occurs when the timer reaches $00. at this time the timer counter is loaded with the value stored in t8bdr and the 8-bit counter will continue to count down at the selected clock rate. t8bf ?8-bit timer b under?w ?g 1 (set) under?w has occurred. 0 (clear) no under?w has occurred. set when 8-bit modulus timer b reaches $00. an interrupt is generated if enabled by t8bi. this bit is cleared by a write to the t8bcr register with t8bf set . bits [5, 4] ?not implemented; always read zero prb ?8-bit timer b preset a write to the t8bcr register with this bit set will preset the timer b counter to the modulus register value. the clock must be stopped before writing to the register. this bit always reads as 0. csb[2:0] ?8-bit timer b clock rate these bits select the timer b clock, as shown in table 8-6. at reset, timer b is not clocked. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset 8-bit modulus timer b data (t8bdr) $005a (bit 7) (6) (5) (4) (3) (2) (1) (0) undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset 8-bit modulus timer b control (t8bcr) $005e t8bi t8bf 0 0 prb csb2 csb1 csb0 0000 0000 tpg 171
motorola 8-40 MC68HC11PH8 timing system 8 8.3.2.5 t8cdr ?8-bit modulus timer c data register this 8-bit register contains the value that will be loaded into the timer c down-counter at the next under?w. at reset, timer c is stopped and state of the modulus register is indeterminate. 8.3.2.6 t8ccr ?8-bit modulus timer c control register t8ci8 ?bit timer c interrupt enable 1 (set) hardware interrupt requested when t8cf ?g set. 0 (clear) interrupt disabled. when set, an 8-bit modulus timer interrupt occurs when the timer reaches $00. at this time the timer counter is loaded with the value stored in t8cdr and the 8-bit counter will continue to count down at the selected clock rate. t8cf ?8-bit timer c under?w ?g 1 (set) under?w has occurred. 0 (clear) no under?w has occurred. set when 8-bit modulus timer c reaches $00. an interrupt is generated if enabled by t8ci. this bit is cleared by a write to the t8ccr register with t8cf set . bits [5, 4] ?not implemented; always read zero prc ?8-bit timer c preset a write to the t8ccr register with this bit set will preset the timer c counter to the modulus register value. the clock must be stopped before writing to the register. this bit always reads as 0. csc[2:0] ?8-bit timer c clock rate these bits select the timer c clock, as shown in table 8-6. at reset, timer c is not clocked. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset 8-bit modulus timer c data (t8cdr) $005b (bit 7) (6) (5) (4) (3) (2) (1) (0) undetned address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset 8-bit modulus timer c control (t8ccr) $005f t8ci t8cf 0 0 prc csc2 csc1 csc0 0000 0000 tpg 172
MC68HC11PH8 motorola 9-1 analog-to-digital converter 9 9 analog-to-digital converter the analog-to-digital (a/d) system, a successive approximation converter, uses an all-capacitive charge redistribution technique to convert analog signals to digital values. the a/d converter shares input pins with port e: 9.1 overview the a/d system is an 8-channel, 8-bit, multiplexed-input converter. the vdd ad and vss ad pins are used to input supply voltage to the a/d converter. this allows the supply voltage to be bypassed independently. the converter does not require external sample and hold circuits because of the type of charge redistribution technique used. a/d converter timing can be synchronized to the system e clock, or to an internal resistor capacitor (rc) oscillator. the a/d converter system consists of four functional blocks: multiplexer, analog converter, digital control and result storage. refer to figure 9-1. pin alternate function pe0 ad0 pe1 ad1 pe2 ad2 pe3 ad3 pe4 ad4 pe5 ad5 pe6 ad6 pe7 ad7 tpg 173
motorola 9-2 MC68HC11PH8 analog-to-digital converter 9 9.1.1 multiplexer the multiplexer selects one of 16 inputs for conversion. input selection is controlled by the value of bits cd ?ca in the adctl register. the eight port e pins are ?ed-direction analog inputs to the multiplexer, and additional internal analog signal lines are routed to it. port e pins can also be used as digital inputs (see section 4). digital reads of port e pins should be avoided during the sample portion of an a/d conversion cycle, when the gate signal to the n-channel input gate is on. because no p-channel devices are directly connected to either input pins or reference voltage pins, voltages above v dd do not cause a latchup problem, although current and voltage should be limited according to maximum ratings. refer to figure 9-2, which is a functional diagram of an input pin. figure 9-1 a/d converter block diagram pe0/ ad0 pe1/ ad1 pe2/ ad2 pe3/ ad3 pe4/ ad4 pe5/ ad5 pe6/ ad6 pe7/ ad7 ccf 0 scan mult cd cc cb ca adctl e a/d control analog mux result register interface adr1 - a/d result 1 adr2 - a/d result 2 adr3 - a/d result 3 adr4 - a/d result 4 successive approximation register and control 8-bit capacitive dac with sample and hold vrh vrl result internal data bus tpg 174
MC68HC11PH8 motorola 9-3 analog-to-digital converter 9 9.1.2 analog converter conversion of an analog input selected by the multiplexer occurs in this block. it contains a digital-to-analog capacitor (dac) array, a comparator, and a successive approximation register (sar). each conversion is a sequence of eight comparison operations, beginning with the most signi?ant bit (msb). each comparison determines the value of a bit in the sar. the dac array performs two functions. it acts as a sample and hold circuit during the entire conversion sequence, and provides comparison voltage to the comparator during each successive comparison. the result of each successive comparison is stored in the sar. when a conversion sequence is complete, the contents of the sar are transferred to the appropriate result register. a charge pump provides switching voltage to the gates of analog switches in the multiplexer. charge pump output must stabilize between 7 and 8 volts within up to 100 m s before the converter can be used. the charge pump is enabled by the adpu bit in the option register. 9.1.3 digital control all a/d converter operations are controlled by bits in register adctl. in addition to selecting the analog input to be converted, adctl bits indicate conversion status, and control whether single or continuous conversions are performed. finally, the adctl bits determine whether conversions are performed on single or multiple channels. figure 9-2 electrical model of an a/d input pin (in sample mode) 4k w <2pf v rl analog input 400na junction leakage diffusion and poly coupler 20pf dac capacitance note 1: the analog switch is closed only during the 12 cycle sample time note 1 input protection device +20v e0.7v note 2: all component values are approximate tpg 175
motorola 9-4 MC68HC11PH8 analog-to-digital converter 9 9.1.4 result registers four 8-bit registers (adr1 ?adr4) store conversion results. each of these registers can be accessed by the processor in the cpu. the conversion complete ?g (ccf) indicates when valid data is present in the result registers. the result registers are written during a portion of the system clock cycle when reads do not occur, so there is no con?ct. 9.1.5 a/d converter clocks the csel bit in the option register selects whether the a/d converter uses the system e clock or an internal rc oscillator for synchronization. when e clock frequency is below 750khz, charge leakage in the capacitor array can cause errors, and the internal oscillator should be used. when the rc clock is used, additional errors can occur because the comparator is sensitive to the additional system clock noise. 9.1.6 conversion sequence a/d converter operations are performed in sequences of four conversions each. a conversion sequence can repeat continuously or stop after one iteration. the conversion complete ?g (ccf) is set after the fourth conversion in a sequence to show the availability of data in the result registers. figure 9-3 shows the timing of a typical sequence. synchronization is referenced to the system e clock. figure 9-3 a/d conversion sequence e clock sample analog input successive approximation sequence 12 cycles 4 cycles 2 cyc 2 cyc 2 cyc 2 cyc 2 cyc 2 cyc 2 cyc 2 cyc msb bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 end write to adctl convert trst channel and update adr1 convert second channel and update adr2 convert third channel and update adr3 convert fourth channel and update adr4 set ccf ?ag repeat sequence if scan = 1 0 32 64 96 128 e clock cycles tpg 176
MC68HC11PH8 motorola 9-5 analog-to-digital converter 9 9.1.7 conversion process the a/d conversion sequence begins one e clock cycle after a write to the a/d control/status register, adctl. the bits in adctl select the channel and the mode of conversion. an input voltage equal to v rl converts to $00 and an input voltage equal to v rh converts to $ff (full scale), with no over?w indication. for ratiometric conversions of this type, the source of each analog input should use v rh as the supply voltage and be referenced to v rl . 9.2 a/d converter power-up and clock select adpu (bit 7 of the option register) controls a/d converter power up. clearing adpu removes power from and disables the a/d converter system; setting adpu enables the a/d converter system. after the a/d converter is turned on, the analog bias voltages will take up to 100 m s to stabilize. when the a/d converter system is operating from the mcu e clock, all switching and comparator operations are synchronized to the mcu clocks. this allows the comparator results to be sampled at ?uiet times, which minimizes noise errors. the internal rc oscillator is asynchronous with respect to the mcu clock, so noise can affect the a/d converter results. this results in a slightly lower typical accuracy when using the internal oscillator (csel = 1). 9.2.1 option ?system con?uration options register 1 the 8-bit special-purpose option register sets internal system con?uration options during initialization. the time protected control bits, irqe, dly, fcme and cr[1:0] can be written to only once in the ?st 64 cycles after a reset and then they become read-only bits. this minimizes the possibility of any accidental changes to the system con?uration. they may be written at any time in special modes. adpu ?a/d power-up 1 (set) a/d system power enabled. 0 (clear) a/d system disabled, to reduce supply current. after enabling the a/d power, at least 100 m s should be allowed for system stabilization. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system contg. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 tpg 177
motorola 9-6 MC68HC11PH8 analog-to-digital converter 9 csel ?clock select 1 (set) a/d, eprom and eeprom use internal rc clock source (about 1.5mhz). 0 (clear) a/d, eprom and eeprom use system e clock (must be at least 1mhz). selects alternate clock source for on-chip eprom , eeprom and a/d charge pumps. the on-chip rc clock should be used when the e clock frequency falls below 1mhz. irqe ?con?ure irq for falling edge sensitive operation (refer to section 3) 1 (set) falling edge sensitive operation. 0 (clear) low level sensitive operation. dly ?enable oscillator start-up delay (refer to section 3) 1 (set) a stabilization delay is imposed as the mcu is started up from stop mode or from power-on reset. 0 (clear) the oscillator start-up delay coming out of stop is bypassed and the mcu resumes processing within about four bus cycles. a stable external oscillator is required if this option is selected. cme ?clock monitor enable (refer to section 10) 1 (set) clock monitor enabled. 0 (clear) clock monitor disabled. fcme ?force clock monitor enable (refer to section 10) 1 (set) clock monitor enabled, cannot be disabled until next reset. 0 (clear) clock monitor follows the state of the cme bit. cr[1:0] ?cop timer rate select bits (refer to section 10) tpg 178
MC68HC11PH8 motorola 9-7 analog-to-digital converter 9 9.3 channel assignments the multiplexer allows the a/d converter to select one of sixteen analog signals. eight of these channels correspond to port e input lines to the mcu, four others are internal reference points or test functions; the remaining four channels are reserved. refer to table 9-1. 9.3.1 single-channel operation there are two types of single-channel operation. in the ?st type (scan = 0), the single selected channel is converted four consecutive times. the ?st result is stored in a/d result register 1 (adr1), and the fourth result is stored in adr4. after the fourth conversion is complete, all conversion activity is halted until a new conversion command is written to the adctl register. in the second type of single-channel operation (scan = 1), conversions continue to be performed on the selected channel with the ?th conversion being stored in register adr1 (overwriting the ?st conversion result), the sixth conversion overwriting adr2, and so on. (1) used for factory testing. table 9-1 a/d converter channel assignments channel number channel signal result in adrx if mult = 1 1 ad0 adr1 2 ad1 adr2 3 ad2 adr3 4 ad3 adr4 5 ad4 adr1 6 ad5 adr2 7 ad6 adr3 8 ad7 adr4 9e12 reserved ? 13 v rh (1) adr1 14 v rl (1) adr2 15 v rh /2 (1) adr3 16 reserved (1) adr4 tpg 179
motorola 9-8 MC68HC11PH8 analog-to-digital converter 9 9.3.2 multiple-channel operation there are two types of multiple-channel operation. in the ?st type (scan = 0), a selected group of four channels is converted once only. the ?st result is stored in a/d result register 1 (adr1), and the fourth result is stored in adr4. after the fourth conversion is complete, all conversion activity is halted until a new conversion command is written to the adctl register. in the second type of multiple-channel operation (scan = 1), conversions continue to be performed on the selected group of channels with the ?th conversion being stored in register adr1 (replacing the earlier conversion result for the ?st channel in the group), the sixth conversion overwriting adr2, and so on. 9.4 control, status and results registers 9.4.1 adctl ?a/d control and status register all bits in this register can be read or written, except bit 7, which is a read-only status indicator, and bit 6, which always reads as zero. write to adctl to initiate a conversion. to quit a conversion in progress, write to this register and a new conversion sequence begins immediately. ccf ?conversions complete ?g 1 (set) all four a/d result registers contain valid conversion data. 0 (clear) at least one of the a/d result registers contains invalid data. a read-only status indicator, this bit is set when all four a/d result registers contain valid conversion results. each time the adctl register is overwritten, this bit is automatically cleared to zero and a conversion sequence is started. in the continuous mode, ccf is set at the end of the ?st conversion sequence. bit 6 ?not implemented; always reads zero. scan ?continuous scan control 1 (set) a/d conversions take place continuously. 0 (clear) each of the four conversions is performed only once. when this control bit is clear, the four requested conversions are performed once to ?l the four result registers. when this control bit is set, the four conversions are repeated continuously with the result registers updated as data becomes available. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d control & status (adctl) $0030 ccf 0 scan mult cd cc cb ca u0uu uuuu tpg 180
MC68HC11PH8 motorola 9-9 analog-to-digital converter 9 mult ?multiple-channel/single-channel control 1 (set) each a/d channel has a result register allocated to it. 0 (clear) four consecutive conversions from the same a/d channel are stored in the results registers. when this bit is clear, the a/d converter system is con?ured to perform four consecutive conversions on the single channel speci?d by the four channel select bits cd?a (bits 3? of the adctl register). when this bit is set, the a/d system is con?ured to perform a conversion on each of the four channels where each result register corresponds to one channel. note: when the multiple-channel continuous scan mode is used, extra care is needed in the design of circuitry driving the a/d inputs. the charge on the capacitive dac array before the sample time is related to the voltage on the previously converted channel. a charge share situation exists between the internal dac capacitance and the external circuit capacitance. although the amount of charge involved is small, the rate at which it is repeated is every 64 m s for an e clock of 2 mhz. the rc charging rate of the external circuit must be balanced against this charge sharing effect to avoid errors in accuracy. refer to the m68hc11 reference manual (m68hc11rm/ad) for further information. cd?a ?channel selects d? when a multiple channel mode is selected (mult = 1), the two least signi?ant channel select bits (cb and ca) have no meaning and the cd and cc bits specify which group of four channels is to be converted. channel select control bits channel signal result in adrx if mult = 1 cd:cc:cb:ca 0 0 0 0 ad0 adr1 0 0 0 1 ad1 adr2 0 0 1 0 ad2 adr3 0 0 1 1 ad3 adr4 0 1 0 0 ad4 adr1 0 1 0 1 ad5 adr2 0 1 1 0 ad6 adr3 0 1 1 1 ad7 adr4 1 0 x x reserved ? 1 1 0 0 v rh (1) adr1 1 1 0 1 v rl (1) adr2 1 1 1 0 v rh /2 (1) adr3 1 1 1 1 reserved (1 ) adr4 tpg 181
motorola 9-10 MC68HC11PH8 analog-to-digital converter 9 9.4.2 adr1?dr4 ?a/d converter results registers these read-only registers hold an 8-bit conversion result. writes to these registers have no effect. data in the a/d converter result registers is valid when the ccf ?g in the adctl register is set, indicating a conversion sequence is complete. if conversion results are needed sooner, refer to figure 9-3, which shows the a/d conversion sequence diagram. 9.5 operation in stop and wait modes if a conversion sequence is in progress when either the stop or wait mode is entered, the conversion of the current channel is suspended. when the mcu resumes normal operation, that channel is resampled and the conversion sequence is resumed. as the mcu exits the wait mode, the a/d circuits are stable and valid results can be obtained on the ?st conversion. however, in stop mode, all analog bias currents are disabled and it is necessary to allow a stabilization period when leaving the stop mode. if the stop mode is exited with a delay (dly = 1), there is enough time for these circuits to stabilize before the ?st conversion. if the stop mode is exited with no delay (dly bit in option register = 0), allow 10 ms for the a/d circuitry to stabilize to avoid invalid results. (1) used for factory testing. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset a/d result 1 (adr1) $0031 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned a/d result 2 (adr2) $0032 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned a/d result 3 (adr3) $0033 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned a/d result 4 (adr4) $0034 (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) undetned tpg 182
MC68HC11PH8 motorola 10-1 resets and interrupts 10 10 resets and interrupts resets and interrupt operations load the program counter with a vector that points to a new location from which instructions are to be fetched. a reset immediately stops execution of the current instruction and forces the program counter to a known starting address. internal registers and control bits are initialized so that the mcu can resume executing instructions. an interrupt temporarily suspends normal program execution whilst an interrupt service routine is being executed. after an interrupt has been serviced, the main program resumes as if there had been no interruption. 10.1 resets there are four possible sources of reset. power-on reset (por) and external reset share the normal reset vector. the computer operating properly (cop) reset and the clock monitor reset each has its own vector. 10.1.1 power-on reset a positive transition on vdd generates a power-on reset (por), which is used only for power-up conditions. por cannot be used to detect drops in power supply voltages. a delay is imposed which allows the clock generator to stabilize after the oscillator becomes active. if reset is at logical zero at the end of the delay time, the cpu remains in the reset condition until reset goes to logical one. a mask option selects one of two delay times; either 128 or 4064 t cyc (internal clock cycles). note: this mask option is not available on the mc68hc711ph8, where the delay time is 4064 t cyc . it is important to protect the mcu during power transitions. most m68hc11 systems need an external circuit that holds the reset pin low whenever v dd is below the minimum operating level. this external voltage level detector, or other external reset circuits, are the usual source of reset in a system. the por circuit only initializes internal circuitry during cold starts. refer to figure 2-3. tpg 183
motorola 10-2 MC68HC11PH8 resets and interrupts 10 10.1.2 external reset (reset ) the cpu distinguishes between internal and external reset conditions by sensing whether the reset pin rises to a logic one in less than four e clock cycles after an internal device releases reset. when a reset condition is sensed, the reset pin is driven low by an internal device for eight e clock cycles, then released. four e clock cycles later it is sampled. if the pin is still held low, the cpu assumes that an external reset has occurred. if the pin is high, it indicates that the reset was initiated internally by either the cop system or the clock monitor. it is not advisable to connect an external resistor capacitor (rc) power-up delay circuit to the reset pin of m68hc11 devices because the circuit charge time constant can cause the device to misinterpret the type of reset that occurred. to guarantee recognition of an external reset, the reset pin should be held low for at least 16 clock cycles. 10.1.3 cop reset the mcu includes a cop system to help protect against software failures. when the cop is enabled, the software is responsible for keeping a free-running watchdog timer from timing out. when the software is no longer being executed in the intended sequence, a system reset is initiated. the state of the nocop bit in the config register determines whether the cop system is enabled or disabled. to change the enable status of the cop system, change the contents of the config register and then perform a system reset. in the special test and bootstrap operating modes, the cop system is initially inhibited by the disable resets (disr) control bit in the test1 register. the disr bit can subsequently be written to zero to enable cop resets. the cop function has two possible clock sources. when pll clock generation is not used (vddsyn = 0), the clocking chain for the cop function is tapped off from the main timer divider chain (e/2 15 ); refer to figure 8-1. when the pll clock generation is used (vddsyn = 1), the cop function can be clocked by the under?w of the 8-bit modulus timer a (clk64/4); see figure 8-2. the cop timer rate control bits cr[1:0] in the option register determine the cop timeout period. the cop clock source frequency is scaled by the factor shown in table 10-1 or table 10-2. after reset, bits cr[1:0] are zero, which selects the shortest timeout period. in normal operating modes, these bits can only be written once, within 64 bus cycles after reset. tpg 184
MC68HC11PH8 motorola 10-3 resets and interrupts 10 10.1.3.1 coprst ?arm/reset cop timer circuitry register complete the following reset sequence to service the cop timer. write $55 to coprst to arm the cop timer clearing mechanism. then write $aa to coprst to clear the cop timer. executing instructions between these two steps is possible as long as both steps are completed in the correct sequence before the timer times out. (1) the timeout period has a tolerance of e0/+one cycle of the e/2 15 clock due to the asynchronous implementation of the cop circuitry. for example, with extali = 8mhz, the uncertainty is e0/+16.384ms. see also the m68hc11 reference manual, (m68hc11rm/ad) . (1) the timeout period has a tolerance of e0/+one cycle of the clk64/4 clock due to the asynchronous implementation of the cop circuitry. for example, with clk64 = 64 hz, the uncertainty is e0/+62.5ms. see also the m68hc11 reference manual, (m68hc11rm/ad) . table 10-1 cop timer rate select (pll disabled) cr[1:0] divide e/2 15 by extali = 8mhz: timeout (1) extali = 12mhz: timeout (1) extali = 16mhz: timeout (1) 0 0 1 16.384 ms 10.923 ms 8.192 ms 0 1 4 65.536 ms 43.691 ms 32.768 ms 1 0 16 262.14 ms 174.76 ms 131.07 ms 1 1 64 1.049 sec 699.05 ms 524.29 ms e = 2.0 mhz 3.0 mhz 4.0 mhz table 10-2 cop timer rate select (pll enabled) cr[1:0] divide clk64 by clk64 = 4.096 khz: timeout (1) clk64 =64 hz: timeout (1) clk64 = 4 hz: timeout (1) 0 0 4 1 ms 62.5 ms 1 s 0 1 16 3.9 ms 250 ms 4 s 1 0 64 15.6 ms 1 s 16 s 1 1 256 62.5 sec 4 s 64 s address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset cop timer arm/reset (coprst) $003a (bit 7) (6) (5) (4) (3) (2) (1) (bit 0) not affected tpg 185
motorola 10-4 MC68HC11PH8 resets and interrupts 10 10.1.4 clock monitor reset the clock monitor circuit is based on an internal rc time delay. if no mcu clock edges are detected within this rc time delay, the clock monitor can optionally generate a system reset. the clock monitor function is enabled or disabled by the cme control bit in the option register. the presence of a timeout is determined by the rc delay, which allows the clock monitor to operate without any mcu clocks. clock monitor is used as a backup for the cop system. because the cop needs a clock to function, it is disabled when the clocks stop. therefore, the clock monitor system can detect clock failures not detected by the cop system. semiconductor wafer processing causes variations of the rc timeout values between individual devices. an e clock frequency below 10 khz is detected as a clock monitor error. an e clock frequency of 200 khz or more prevents clock monitor errors. using the clock monitor function when the e clock is below 200 khz is not recommended. special considerations are needed when a stop instruction is executed and the clock monitor is enabled. because the stop function causes the clocks to be halted, the clock monitor function generates a reset sequence if it is enabled at the time the stop mode was initiated. before executing a stop instruction, clear the cme bit in the option register to zero to disable the clock monitor. after recovery from stop, set the cme bit to logic one to enable the clock monitor. 10.1.5 option ?system con?uration options register 1 the special-purpose option register sets internal system con?uration options during initialization. the time protected control bits (irqe, dly, fcme and cr[1:0]) can be written to only once in the ?st 64 cycles after a reset and then they become read-only bits. this minimizes the possibility of any accidental changes to the system con?uration. they may be written at any time in special modes. adpu ?a/d power-up (refer to section 9) 1 (set) a/d system power enabled. 0 (clear) a/d system disabled, to reduce supply current. csel ?clock select (refer to section 9) 1 (set) a/d, eprom and eeprom use internal rc clock (about 1.5mhz). 0 (clear) a/d, eprom and eeprom use system e clock (must be at least 1mhz). address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset system contg. options 1 (option) $0039 adpu csel irqe dly cme fcme cr1 cr0 0001 0000 tpg 186
MC68HC11PH8 motorola 10-5 resets and interrupts 10 irqe ?con?ure irq for falling edge sensitive operation (refer to section 3) 1 (set) falling edge sensitive operation. 0 (clear) low level sensitive operation. dly ?enable oscillator start-up delay 1 (set) a stabilization delay is imposed as the mcu is started up from stop mode (or from power-on reset). 0 (clear) the oscillator start-up delay is bypassed and the mcu resumes processing within about four bus cycles. a stable external oscillator is required if this option is selected. note: because dly is set on reset, a delay is always imposed as the mcu is started up from power-on reset. a mask option on the MC68HC11PH8 allows the selection of either a short or long delay time for power-on reset and exit from stop mode; either 128 or 4064 bus cycles. this option is not available on the mc68hc711ph8 where the delay time is 4064 bus cycles. cme ?clock monitor enable 1 (set) clock monitor enabled. 0 (clear) clock monitor disabled. this control bit can be read or written at any time and controls whether or not the internal clock monitor circuit triggers a reset sequence when the system clock is slow or absent. when it is clear, the clock monitor circuit is disabled, and when it is set, the clock monitor circuit is enabled. reset clears the cme bit. in order to use both stop and clock monitor, the cme bit should be cleared before executing stop, then set again after recovering from stop. fcme ?force clock monitor enable 1 (set) clock monitor enabled; cannot be disabled until next reset. 0 (clear) clock monitor follows the state of the cme bit. when fcme is set, slow or stopped clocks will cause a clock failure reset sequence. to utilize stop mode, fcme should always be cleared. cr[1:0] ?cop timer rate select bits the cop function can be clocked either by the internal e clock divided by 2 15 , or by the output of the 8-bit modulus timer a, clk64/4. these control bits determine a scaling factor for the watchdog timer period. see table 10-1 and table 10-2. tpg 187
motorola 10-6 MC68HC11PH8 resets and interrupts 10 10.1.6 config ?con?uration control register among other things, config controls the presence and location of eeprom in the memory map and enables the cop watchdog system. a security feature that protects data in eeprom and ram is available on mask programmed mcus. config is made up of eeprom cells and static working latches. the operation of the mcu is controlled directly by these latches and not the eeprom byte. when programming the config register, the eeprom byte is accessed. when the config register is read, the static latches are accessed. these bits can be read at any time. the value read is the one latched into the register from the eeprom cells during the last reset sequence. a new value programmed into this register is not readable until after a subsequent reset sequence. on the mc68hc711ph8 , and on the MC68HC11PH8 if selected by a mask option, the romon bit can be written at any time if mda = 1 (expanded mode or special test mode). it cannot be written in bootstrap mode, and is forced to a logic one in single chip mode. other bits in config can be written at any time if smod = 1 (bootstrap or special test mode). if smod = 0 (single chip or expanded mode), these bits can only be written using the eeprom programming sequence, and none of the bits are readable or active until latched via the next reset. freez is only active in expanded user mode. romad ?rom/ eprom mapping control (refer to section 3) 1 (set) rom addressed from $4000 to $ffff. 0 (clear) rom addressed from $0000 to $bfff (expanded mode only). in single chip mode, reset sets this bit. freez ?expanded user mode address bus freeze (refer to section 3) 1 (set) the external bus is only active when externally mapped resources are accessed (expanded mode only) 0 (clear) normal operation. clk4x ?4x clock enable (refer to section 3) 1 (set) 4xclk or extali driven out on the 4xout pin. 0 (clear) 4xout pin disabled. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset contguration control (config) $003f romad freez clk4x paren nosec nocop romon eeon xxxx xxxx tpg 188
MC68HC11PH8 motorola 10-7 resets and interrupts 10 paren ?pull-up assignment register enable (refer to section 4) 1 (set) ppar register enabled; pull-ups can be enabled using ppar. 0 (clear) ppar register disabled; all pull-ups disabled. nosec ?eeprom security disabled (refer to section 3) 1 (set) disable security. 0 (clear) enable security. nocop ?cop system disable 1 (set) cop system disabled. 0 (clear) cop system enabled (forces reset on timeout). romon ?rom/ eprom enable (refer to section 3) 1 (set) rom/ eprom included in the memory map. 0 (clear) rom/ eprom excluded from the memory map. eeon ?eeprom enable (refer to section 3) 1 (set) eeprom included in the memory map. 0 (clear) eeprom excluded from the memory map. 10.2 effects of reset when a reset condition is recognized, the internal registers and control bits are forced to an initial state. depending on the cause of the reset and the operating mode, the reset vector can be fetched from any of six possible locations, as shown in table 10-3. these initial states then control on-chip peripheral systems to force them to known start-up states, as described in the following paragraphs. table 10-3 reset cause, reset vector and operating mode cause of reset normal mode vector special test or bootstrap por or reset pin $fffe, $ffff $bffe, $bfff clock monitor failure $fffc, $fffd $bffc, $bffd cop watchdog timeout $fffa, $fffb $bffa, $bffb tpg 189
motorola 10-8 MC68HC11PH8 resets and interrupts 10 10.2.1 central processing unit after reset, the cpu fetches the restart vector from the appropriate address during the ?st three cycles, and begins executing instructions. the stack pointer and other cpu registers are indeterminate immediately after reset; however, the x and i interrupt mask bits in the condition code register (ccr) are set to mask any interrupt requests. also, the s-bit in the ccr is set to inhibit the stop mode. 10.2.2 memory map after reset, the init register is initialized to $00, putting the 2k bytes of ram at locations $0080?087f, and the control registers at locations $0000?007f. the init2 register puts eeprom at locations $0d00?0fff. 10.2.3 parallel i/o when a reset occurs in expanded operating modes, port b, c, and f pins used for parallel i/o are dedicated to the expansion bus. if a reset occurs during a single chip operating mode, all ports are con?ured as general purpose high-impedance inputs. note: do not confuse pin function with the electrical state of the pin at reset. all general-purpose i/o pins con?ured as inputs at reset are in a high-impedance state. port data registers re?ct the ports functional state at reset. the pin function is mode dependent. 10.2.4 timer during reset, the timer system is initialized to a count of $0000. the prescaler bits are cleared, and all output compare registers are initialized to $ffff. all input capture registers are indeterminate after reset. the output compare 1 mask (oc1m) register is cleared so that successful oc1 compares do not affect any i/o pins. the other four output compares are con?ured so that they do not affect any i/o pins on successful compares. all input capture edge-detector circuits are con?ured for capture disabled operation. the timer over?w interrupt ?g and all eight timer function interrupt ?gs are cleared. all nine timer interrupts are disabled because their mask bits have been cleared. the i4/o5 bit in the pactl register is cleared to con?ure the i4/o5 function as oc5; however, the om5:ol5 control bits in the tctl1 register are clear so oc5 does not control the pa3 pin. tpg 190
MC68HC11PH8 motorola 10-9 resets and interrupts 10 10.2.5 real-time interrupt (rti) the real-time interrupt ?g (rtif) is cleared and automatic hardware interrupts are masked. the rate control bits are cleared after reset and can be initialized by software before the real-time interrupt (rti) system is used. 10.2.6 pulse accumulator the pulse accumulator system is disabled at reset so that the pulse accumulator input (pai) pin defaults to being a general-purpose input pin. 10.2.7 computer operating properly (cop) the cop watchdog system is enabled if the nocop control bit in the config register is cleared, and disabled if nocop is set. the cop rate is set for the shortest duration timeout. 10.2.8 8-bit modulus timer system on reset, the clock source for timer a is set at extali/8 and the associated modulus register is initialized to $ff. timers b and c are stopped on reset and pins ph6 and ph7 default to being general purpose i/o pins. 10.2.9 serial communications interface (sci) the reset condition of the sci system is independent of the operating mode. at reset, the sci baud rate control register is initialized to $0004. all transmit and receive interrupts are masked and both the transmitter and receiver are disabled so the port pins default to being general purpose i/o lines. the sci frame format is initialized to an 8-bit character size. the send break and receiver wake-up functions are disabled. the tdre and tc status bits in the sci status register are both set, indicating that there is no transmit data in either the transmit data register or the transmit serial shift register. the rdrf, idle, or, nf, fe, pf, and raf receive-related status bits are cleared. note: the foregoing paragraph also applies to sci2. the mi bus function is disabled, since mie2 is cleared on reset. tpg 191
motorola 10-10 MC68HC11PH8 resets and interrupts 10 10.2.10 serial peripheral interface (spi) the spi1 and spi2 systems are disabled by reset. their associated port pins default to being general purpose i/o lines. 10.2.11 analog-to-digital converter the a/d converter con?uration is indeterminate after reset. the adpu bit is cleared by reset, which disables the a/d system. the conversion complete ?g is cleared by reset. 10.2.12 lcd module the lcd module is disabled by reset. pb4-pb7 default to being general purpose i/o lines in single chip mode, or higher order address outputs in expanded mode. 10.2.13 system the eeprom programming controls are disabled, so the memory system is con?ured for normal read operation. psel[4:0] are initialized with the binary value %00110, causing the external irq pin to have the highest i-bit interrupt priority. the irq pin is con?ured for level-sensitive operation (for wired-or systems). the rboot, smod, and mda bits in the hprio register re?ct the status of the modb and moda inputs at the rising edge of reset. the dly control bit is set to specify that an oscillator start-up delay is imposed upon recovery from stop mode or power-on reset. the clock monitor system is disabled because cme and fcme are cleared. tpg 192
MC68HC11PH8 motorola 10-11 resets and interrupts 10 10.3 reset and interrupt priority resets and interrupts have a hardware priority that determines which reset or interrupt is serviced ?st when simultaneous requests occur. any maskable interrupt can be given priority over other maskable interrupts. the ?st six interrupt sources are not maskable by the i-bit in the ccr. the priority arrangement for these sources is ?ed and is as follows: 1) por or reset pin 2) clock monitor reset 3) cop watchdog reset 4) xirq interrupt illegal opcode interrupt ?see section 10.4.3 for details of handling software interrupt (swi) ?see section 10.4.4 for details of handling the maskable interrupt sources have the following priority arrangement: 5) irq 6) real-time interrupt 7) timer input capture 1 8) timer input capture 2 9) timer input capture 3 10) timer output compare 1 11) timer output compare 2 12) timer output compare 3 13) timer output compare 4 14) timer input capture 4/output compare 5 15) spi2 transfer complete 16) sci2/mi bus system 17) timer over?w 18) 8-bit modulus timers 19) pulse accumulator over?w 20) pulse accumulator input edge 21) wired-or port h 22) spi1 transfer complete 23) sci1 system any one of these maskable interrupts can be assigned the highest maskable interrupt priority by writing the appropriate value to the psel bits in the hprio register. otherwise, the priority arrangement remains the same. an interrupt that is assigned highest priority is still subject to global masking by the i-bit in the ccr, or by any associated local bits. interrupt vectors are not affected by priority assignment. to avoid race conditions, hprio can only be written while i-bit interrupts are inhibited. tpg 193
motorola 10-12 MC68HC11PH8 resets and interrupts 10 10.3.1 hprio ?highest priority i-bit interrupt and misc. register rboot, smod, and mda bits depend on power-up initialization mode and can only be written in special modes when smod = 1. refer to table 3-4. rboot ?read bootstrap rom (refer to section 3) 1 (set) bootloader rom enabled, at $be40?bfff. 0 (clear) bootloader rom disabled and not in map. smod ?special mode select (refer to section 3) 1 (set) special mode variation in effect. 0 (clear) normal mode variation in effect. mda ?mode select a (refer to section 3) 1 (set) normal expanded or special test mode in effect. 0 (clear) normal single chip or special bootstrap mode in effect. psel[4:0] ?priority select bits these bits select one interrupt source to be elevated above all other i-bit-related sources and can be written to only while the i-bit in the ccr is set (interrupts disabled). see table 10-4. address bit 7 bit 6 bit 5 bit 4 bit 3 bit 2 bit 1 bit 0 state on reset highest priority interrupt (hprio) $003c rboot smod mda psel4 psel3 psel2 psel1 psel0 xxx0 0110 tpg 194
MC68HC11PH8 motorola 10-13 resets and interrupts 10 table 10-4 highest priority interrupt selection pselx interrupt source promoted 43210 0 0 0 x x reserved (default to irq ) 00100 reserved (default to irq ) 00101 reserved (default to irq ) 00110irq (external pin) 00111 real-time interrupt 01000 timer input capture 1 01001 timer input capture 2 01010 timer input capture 3 01011 timer output compare 1 01100 timer output compare 2 01101 timer output compare 3 01110 timer output compare 4 01111 timer output compare 5/input capture 4 10000 timer over?ow 10001 pulse accumulator over?ow 10010 pulse accumulator input edge 10011 spi1 serial transfer complete 10100 sci1 serial system 10101 spi2 serial transfer complete 10110 sci2/mi bus serial system 10111 8-bit modulus timers 11000 wired-or port h 11001 reserved (default to irq ) 1101x reserved (default to irq ) 1 1 1 x x reserved (default to irq ) tpg 195
motorola 10-14 MC68HC11PH8 resets and interrupts 10 table 10-5 interrupt and reset vector assignments vector address interrupt source ccr mask bit local mask ffc0, c1 e ffcc, cd reserved ? ? ffce, cf wired-or port h i ieh[7:0] ffd0, d1 8-bit modulus timer a under?ow 8-bit modulus timer b under?ow 8-bit modulus timer c under?ow i t8ai t8bi t8ci ffd2, d3 sci2/mi bus receive data register full sci2/mi bus receiver overrun sci2 transmit data register empty sci2 transmit complete sci2 idle line detect i rie2 rie2 tie2 tcie2 ilie2 ffd4, d5 spi2 serial transfer complete i sp2ie ffd6, d7 sci1 receive data register full sci1 receiver overrun sci1 transmit data register empty sci1 transmit complete sci1 idle line detect i rie rie tie tcie ilie ffd8, d9 spi1 serial transfer complete i spie ffda, db pulse accumulator input edge i paii ffdc, dd pulse accumulator over?ow i paovi ffde, df timer over?ow i toi ffe0, e1 timer input capture 4/output compare 5 i i4/o5i ffe2, e3 timer output compare 4 i oc4i ffe4, e5 timer output compare 3 i oc3i ffe6, e7 timer output compare 2 i oc2i ffe8, e9 timer output compare 1 i oc1i ffea, eb timer input capture 3 i ic3i ffec, ed timer input capture 2 i ic2i ffee, ef timer input capture 1 i ic1i fff0, f1 real-time interrupt i rtii fff2, f3 irq pin i none fff4, f5 xirq pin x none fff6, f7 software interrupt none none fff8, f9 illegal opcode trap none none fffa, fb cop failure none nocop fffc, fd clock monitor fail none cme fffe, ff reset none none tpg 196
MC68HC11PH8 motorola 10-15 resets and interrupts 10 10.4 interrupts excluding reset type interrupts, the MC68HC11PH8 has 22 interrupt vectors that support 32 interrupt sources. the 19 maskable interrupts are generated by on-chip peripheral systems. these interrupts are recognized when the global interrupt mask bit (i) in the condition code register (ccr) is clear. the three nonmaskable interrupt sources are illegal opcode trap, software interrupt, and xirq pin. refer to table 10-5, which shows the interrupt sources and vector assignments for each source. for some interrupt sources, such as the sci interrupts, the ?gs are automatically cleared during the normal course of responding to the interrupt requests. for example, the rdrf ?g in the sci system is cleared by the automatic clearing mechanism consisting of a read of the sci status register while rdrf is set, followed by a read of the sci data register. the normal response to an rdrf interrupt request would be to read the sci status register to check for receive errors, then to read the received data from the sci data register. these two steps satisfy the automatic clearing mechanism without requiring any special instructions. 10.4.1 interrupt recognition and register stacking an interrupt can be recognized at any time after it is enabled by its local mask, if any, and by the global mask bit in the ccr. once an interrupt source is recognized, the cpu responds at the completion of the instruction being executed. interrupt latency varies according to the number of cycles required to complete the current instruction. when the cpu begins to service an interrupt, the contents of the cpu registers are pushed onto the stack in the order shown in table 10-6. after the ccr value is stacked, the i-bit and the x-bit, if xirq is pending, are set to inhibit further interrupts. the interrupt vector for the highest priority pending source is fetched, and execution continues at the address speci?d by the vector. at the end of the interrupt service routine, the return from interrupt instruction is executed and the saved registers are pulled from the stack in reverse order so that normal program execution can resume. refer to section 11 for further information. table 10-6 stacking order on entry to interrupts memory location cpu registers sp pcl sp e 1 pch sp e 2 iyl sp e 3 iyh sp e 4 ixl sp e 5 ixh sp e 6 acca sp e 7 accb sp e 8 ccr tpg 197
motorola 10-16 MC68HC11PH8 resets and interrupts 10 10.4.2 nonmaskable interrupt request (xirq ) nonmaskable interrupts are useful because they can always interrupt cpu operations. the most common use for such an interrupt is for serious system problems, such as program runaway or power failure. the xirq input is an updated version of the nmi (nonmaskable interrupt) input of earlier mcus. upon reset, both the x-bit and i-bit of the ccr are set to inhibit all maskable interrupts and xirq . after minimum system initialization, software can clear the x-bit by a tap instruction, enabling xirq interrupts. thereafter, software cannot set the x-bit. thus, an xirq interrupt is a nonmaskable interrupt. because the operation of the i-bit-related interrupt structure has no effect on the x-bit, the internal xirq pin remains unmasked. in the interrupt priority logic, the xirq interrupt has a higher priority than any source that is maskable by the i-bit. all i-bit-related interrupts operate normally with their own priority relationship. when an i-bit-related interrupt occurs, the i-bit is automatically set by hardware after stacking the ccr byte. the x-bit is not affected. when an x-bit-related interrupt occurs, both the x and i bits are automatically set by hardware after stacking the ccr. a return from interrupt instruction restores the x and i bits to their pre-interrupt request state. 10.4.3 illegal opcode trap because not all possible opcodes or opcode sequences are de?ed, the mcu includes an illegal opcode detection circuit, which generates an interrupt request. when an illegal opcode is detected and the interrupt is recognized, the current value of the program counter is stacked. after interrupt service is complete, the user should reinitialize the stack pointer to ensure that repeated execution of illegal opcodes does not cause stack under?w. left uninitialized, the illegal opcode vector can point to a memory location that contains an illegal opcode. this condition causes an in?ite loop that causes stack under?w. the stack grows until the system crashes. the illegal opcode trap mechanism works for all unimplemented opcodes on all four opcode map pages. the address stacked as the return address for the illegal opcode interrupt is the address of the ?st byte of the illegal opcode. otherwise, it would be almost impossible to determine whether the illegal opcode had been one or two bytes. the stacked return address can be used as a pointer to the illegal opcode, so that the illegal opcode service routine can evaluate the offending opcode. 10.4.4 software interrupt swi is an instruction, and thus cannot be interrupted until complete. swi is not inhibited by the global mask bits in the ccr. because execution of swi sets the i mask bit, once an swi interrupt begins, other interrupts are inhibited until swi is complete, or until user software clears the i bit in the ccr. tpg 198
MC68HC11PH8 motorola 10-17 resets and interrupts 10 10.4.5 maskable interrupts the maskable interrupt structure of the mcu can be extended to include additional external interrupt sources through the irq pin. the default con?uration of this pin is a low-level sensitive wired-or network. when an event triggers an interrupt, a software accessible interrupt ?g is set. when enabled, this ?g causes a constant request for interrupt service. after the ?g is cleared, the service request is released. 10.4.6 reset and interrupt processing the following ?w diagrams illustrate the reset and interrupt process. figure 10-1 and figure 10-2 illustrate how the cpu begins from a reset and how interrupt detection relates to normal opcode fetches. figure 10-3 to figure 10-4 provide an expanded version of a block in figure 10-1 and illustrate interrupt priorities. figure 10-7 shows the resolution of interrupt sources within the sci subsystem. 10.5 low power operation both stop and wait suspend cpu operation until a reset or interrupt occurs. the wait condition suspends processing and reduces power consumption to an intermediate level. the stop condition turns off all on-chip clocks and reduces power consumption to an absolute minimum while retaining the contents of all bytes of the ram. 10.5.1 wait the wai opcode places the mcu in the wait condition, during which the cpu registers are stacked and cpu processing is suspended until a quali?d interrupt is detected. the interrupt can be an external irq , an xirq , or any of the internally generated interrupts, such as the timer or serial interrupts. the on-chip crystal oscillator remains active throughout the wait stand-by period. the reduction of power in the wait condition depends on how many internal clock signals driving on-chip peripheral functions can be shut down. the cpu is always shut down during wait. while in the wait state, the address/data bus repeatedly runs read cycles to the address where the ccr contents were stacked. the mcu leaves the wait state when it senses any interrupt that has not been masked. the ph2 clock to the free-running timer system is stopped if the i-bit is set and the cop system is disabled by nocop being set. in addition, further power can be saved if the clock to the 16-bit counter is stopped by clearing the t16en bit in pllcr, with the pll active (see section 8.1.1.1). several other systems can also be in a reduced power consumption state depending on the state of software-controlled con?uration control bits. power consumption by the analog-to-digital (a/d) converter is not affected signi?antly by the wait condition. however, the a/d converter current tpg 199
motorola 10-18 MC68HC11PH8 resets and interrupts 10 can be eliminated by writing the adpu bit to zero and halting the rc clock (csel cleared). the spi system is enabled or disabled by the spe control bit. the sci transmitter is enabled or disabled by the te bit, and the sci receiver is enabled or disabled by the re bit (lowest power consumption is achieved when re=te=0). power consumption is reduced if all the pwm enable bits (pwen[4:1]) are cleared, thereby disabling every pwm channel. setting the wen bit in pllcr will result in wait mode using a slower clock and hence less power (see section 2.5). therefore the power consumption in wait is dependent on the particular application. 10.5.2 stop executing the stop instruction while the s-bit in the ccr is clear places the mcu in the stop condition. if the s-bit is set, the stop opcode is treated as a no-op (nop). the stop condition offers minimum power consumption because all clocks, including the crystal oscillator, are stopped while in this mode. to exit stop and resume normal processing, a logic low level must be applied to one of the external interrupts (irq or xirq ) or to the reset pin. a keyboard interrupt on port h or a pending edge-triggered irq can also bring the cpu out of stop. because all clocks are stopped in this mode, all internal peripheral functions also stop. the data in the internal ram is retained as long as v dd power is maintained. the cpu state and i/o pin levels are static and are unchanged by stop. therefore, when an interrupt comes to restart the system, the mcu resumes processing as if there were no interruption. if reset is used to restart the system a normal reset sequence results where all i/o pins and functions are also restored to their initial states. to use the irq pin as a means of recovering from stop, the i-bit in the ccr must be clear (irq not masked). the xirq pin can be used to wake up the mcu from stop regardless of the state of the x-bit in the ccr, although the recovery sequence depends on the state of the x-bit. if x is clear (xirq not masked), the mcu starts up, beginning with the stacking sequence leading to normal service of the xirq request. if x is set (xirq masked or inhibited), then processing continues with the instruction that immediately follows the stop instruction, and no xirq interrupt service is requested or pending. because the oscillator is stopped in stop mode, a restart delay may be imposed to allow oscillator stabilization upon leaving stop. if the internal oscillator is being used, this delay is required; however, if a stable external oscillator is being used, the dly control bit can be used to bypass this start-up delay. the dly control bit is set by reset and can be optionally cleared during initialization. if the dly equal to zero option is used to avoid start-up delay on recovery from stop, then reset should not be used as the means of recovering from stop, as this causes dly to be set again by reset, imposing the restart delay. this same delay also applies to power-on-reset, regardless of the state of the dly control bit, but does not apply to a reset while the clocks are running. see section 3.3.2.4. tpg 200
MC68HC11PH8 motorola 10-19 resets and interrupts 10 figure 10-1 processing ?w out of reset (1 of 2) xirq pin low? clock monitor fail (cme = 1) cop watchdog timeout (nocop = 0) begin an instruction sequence external reset power-on reset (por) delay (128/4064 cycles ? ) load program counter with contents of $fffc, $fffd (vector fetch) load program counter with contents of $fffe, $ffff (vector fetch) load program counter with contents of $fffa, $fffb (vector fetch) set s, x, and i bits in ccr. reset mcu hardware x-bit in ccr set? stack cpu registers. set x and i bits. fetch vector at $fff4, $fff5 1a 1b no no ye s ye s priority highest lowest ? see section 10.1.5 tpg 201
motorola 10-20 MC68HC11PH8 resets and interrupts 10 figure 10-2 processing ?w out of reset (2 of 2) rti? fetch opcode swi? stack cpu registers. set i bit. fetch vector at $fff8, $fff9 1b 1a i-bit in ccr set? i-bit interrupt pending? legal opcode? wai? execute this instruction ye s no no ye s no no no stack cpu registers. set i bit. fetch vector at $fff6, $fff7 restore cpu registers from stack ye s ye s no stack cpu registers stack cpu registers interrupt yet? set i-bit resolve interrupt priority and fetch vector for highest pending source (figure 10-3) ye s ye s no start next instruction sequence ye s tpg 202
MC68HC11PH8 motorola 10-21 resets and interrupts 10 figure 10-3 interrupt priority resolution (1 of 3) x-bit in ccr set? highest priority interrupt? rtii = 1? ic1i = 1? ic2i = 1? ic3i = 1? oc1i = 1? begin irq ? 2a xirq pin low? set x-bit in ccr. fetch vector at $fff4, $fff5 fetch vector fetch vector at $fff2, $fff3 fetch vector at $fff0, $fff1 fetch vector at $ffee, $ffef fetch vector at $ffec, $ffed fetch vector at $ffea, $ffeb no ye s fetch vector at $ffe8, $ffe9 rtif = 1? ic1f = 1? ic2f = 1? ic3f = 1? oc1f = 1? 2b ye s ye s ye s ye s ye s ye s ye s no no no no no no no ye s ye s ye s ye s ye s no no no no no no ye s tpg 203
motorola 10-22 MC68HC11PH8 resets and interrupts 10 figure 10-4 interrupt priority resolution (2 of 3) modulus timer interrupt? sci2 interrupt? ? oc2i = 1? oc3i = 1? oc4i = 1? i4/o5i = 1? 2a fetch vector at $ffe6, $ffe7 fetch vector at $ffe4, $ffe5 fetch vector at $ffe2, $ffe3 fetch vector at $ffe0, $ffe1 oc2f = 1? oc3f = 1? oc4f = 1? i4/o5f = 1? 2b ye s ye s ye s ye s no no no no ye s ye s ye s ye s no no no no ye s ? refer to figure 10-6 for further details on sci interrupts. refer to figure 10-7 for further details on modulus timer interrupts. fetch vector at $ffd4, $ffd5 fetch vector at $ffd2, $ffd3 2c 2d toi = 1? fetch vector at $ffde, $ffdf tof = 1? ye s no ye s no sp2ie = 1? sp2if = 1? modf2 = 1? fetch vector at $ffd0, $ffd1 ye s no no ye s ye s ye s no no no tpg 204
MC68HC11PH8 motorola 10-23 resets and interrupts 10 figure 10-5 interrupt priority resolution (3 of 3) wired-or interrupt? 2c paii = 1? fetch vector at $ffda, $ffdb paif = 1? 2d ye s no ye s no sci1 interrupt? ? spie = 1? fetch vector at $ffd8, $ffd9 spif = 1? ye s no ye s no modf = 1? no no ye s ye s fetch vector at $fff2, $fff3 spurious interrupt ? take irq vector end ? refer to figure 10-6 for further details on sci interrupts. fetch vector at $ffd6, $ffd7 paovi = 1? fetch vector at $ffdc, $ffdd paovf = 1? ye s no ye s no fetch vector at $ffce, $ffcf woif = 1? ye s ye s no no tpg 205
motorola 10-24 MC68HC11PH8 resets and interrupts 10 figure 10-6 interrupt source resolution within the sci subsystem no begin rdrf = 1? or = 1? tdre = 1? tc = 1? idle = 1? no valid sci interrupt request rie = 1? te = 1? re = 1? tie = 1? tcie = 1? ilie = 1? re = 1? valid sci interrupt request ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s ye s no no no no no no no no no no no note: the bit names shown are for sci1. the diagram applies equally to sci2, when the appropriate bit names are substituted. tpg 206
MC68HC11PH8 motorola 10-25 resets and interrupts 10 figure 10-7 interrupt source resolution within the 8-bit modulus timer subsystem t8ai = 1? t8bi = 1? t8ci = 1? no valid modulus timer interrupt request t8bf = 1? t8af = 1? valid modulus timer interrupt request ye s ye s ye s ye s ye s no no no no no t8cf = 1? begin ye s no tpg 207
motorola 10-26 MC68HC11PH8 resets and interrupts this page intentionally left blank 10 tpg 208
MC68HC11PH8 motorola 11-1 cpu core and instruction set 11 11 cpu core and instruction set this section discusses the m68hc11 central processing unit (cpu) architecture, its addressing modes and the instruction set. for more detailed information on the instruction set, refer to the m68hc11 reference manual (m68hc11rm/ad) . the cpu is designed to treat all peripheral, i/o and memory locations identically, as addresses in the 64kbyte memory map. this is referred to as memory-mapped i/o. there are no special instructions for i/o that are separate from those used for memory. this architecture also allows accessing an operand from an external memory location with no execution-time penalty. 11.1 registers m68hc11 cpu registers are an integral part of the cpu and are not addressed as if they were memory locations. the seven registers are shown in figure 11-1 and are discussed in the following paragraphs. figure 11-1 programming model accumulator a 7 0 accumulator b 70 double accumulator d 15 0 index register x 15 0 index register y 15 0 stack pointer 15 0 program counter 15 0 sc xhinzv a:b d ix iy sp pc ccr condition code register carry over?ow zero negative i interrupt mask half carry (from bit 3) x interrupt mask stop disable tpg 209
motorola 11-2 MC68HC11PH8 cpu core and instruction set 11 11.1.1 accumulators a, b and d accumulators a and b are general purpose 8-bit registers that hold operands and results of arithmetic calculations or data manipulations. for some instructions, these two accumulators are treated as a single double-byte (16-bit) accumulator called accumulator d. although most operations can use accumulators a or b interchangeably, the following exceptions apply: the abx and aby instructions add the contents of 8-bit accumulator b to the contents of 16-bit register x or y, but there are no equivalent instructions that use a instead of b. the tap and tpa instructions transfer data from accumulator a to the condition code register, or from the condition code register to accumulator a, however, there are no equivalent instructions that use b rather than a. the decimal adjust accumulator a (daa) instruction is used after binary-coded decimal (bcd) arithmetic operations, but there is no equivalent bcd instruction to adjust accumulator b. the add, subtract, and compare instructions associated with both a and b (aba, sba, and cba) only operate in one direction, making it important to plan ahead to ensure the correct operand is in the correct accumulator. 11.1.2 index register x (ix) the ix register provides a 16-bit indexing value that can be added to the 8-bit offset provided in an instruction to create an effective address. the ix register can also be used as a counter or as a temporary storage register. 11.1.3 index register y (iy) the 16-bit iy register performs an indexed mode function similar to that of the ix register. however, most instructions using the iy register require an extra byte of machine code and an extra cycle of execution time because of the way the opcode map is implemented. refer to section 11.3 for further information. 11.1.4 stack pointer (sp) the m68hc11 cpu has an automatic program stack. this stack can be located anywhere in the address space and can be any size up to the amount of memory available in the system. normally the sp is initialized by one of the ?st instructions in an application program. the stack is con?ured as a data structure that grows downward from high memory to low memory. each time a new byte is pushed onto the stack, the sp is decremented. each time a byte is pulled from the stack, the sp is incremented. at any given time, the sp holds the 16-bit address of the next free location in the stack. figure 11-2 is a summary of sp operations. tpg 210
MC68HC11PH8 motorola 11-3 cpu core and instruction set 11 figure 11-2 stacking operations $9d = jsr main program jsr, jump to subroutine pc direct dd ff main program next instruction rtn $ad = jsr pc next instruction rtn $18 = pre pc main program $ad = jsr ff next instruction rtn $bd = jsr pc hh ll next instruction rtn main program $8d = bsr pc rr main program next instruction rtn bsr, branch to subroutine $39 = rts pc main program ind, x ind, y extend rtn l sp rtn h spe1 spe2 stack rtn l sp rtn h spe1 spe2 stack rtn l sp+2 rtn h sp+1 sp stack $3b = rti pc sp condition code sp+1 rti, return from interrupt interrupt program stack accumulator b sp+2 accumulator a sp+3 index register (ix h ) sp+4 index register (ix l ) sp+5 index register (iy h ) sp+6 index register (iy l ) sp+7 rtn h sp+8 rtn l sp+9 $3f = swi pc rtn spe9 condition code spe8 main program stack accumulator b spe7 accumulator a spe6 index register (ix h ) spe5 index register (ix l ) spe4 index register (iy h ) spe3 index register (iy l ) spe2 rtn h spe1 swi, software interrupt rtn l sp wai, wait for interrupt $3e = wai pc rtn main program rts, return from subroutine legend rtn address of the next instruction in the main program, to be executed on return from subroutine rtn h more signitcant byte of return address rtn l less signitcant byte of return address shaded cells show stack pointer position after the operation is complete dd 8-bit direct address ($0000e$00ff); the high byte is assumed to be $00 ff 8-bit positive offset ($00 to $ff (0 to 256)) is added to the index register contents hh high order byte of 16-bit extended address ll low order byte of 16-bit extended address rr signed relative offset ($80 to $7f (e128 to +127)); offset is relative to the address following the offset byte tpg 211
motorola 11-4 MC68HC11PH8 cpu core and instruction set 11 when a subroutine is called by a jump to subroutine (jsr) or branch to subroutine (bsr) instruction, the address of the instruction after the jsr or bsr is automatically pushed onto the stack, less signi?ant byte ?st. when the subroutine is ?ished, a return from subroutine (rts) instruction is executed. the rts pulls the previously stacked return address from the stack, and loads it into the program counter. execution then continues at this recovered return address. when an interrupt is recognized, the current instruction ?ishes normally, the return address (the current value in the program counter) is pushed onto the stack, all of the cpu registers are pushed onto the stack, and execution continues at the address speci?d by the vector for the interrupt. at the end of the interrupt service routine, an rti instruction is executed. the rti instruction causes the saved registers to be pulled off the stack in reverse order. program execution resumes at the return address. there are instructions that push and pull the a and b accumulators and the x and y index registers. these instructions are often used to preserve program context. for example, pushing accumulator a onto the stack when entering a subroutine that uses accumulator a, and then pulling accumulator a off the stack just before leaving the subroutine, ensures that the contents of a register will be the same after returning from the subroutine as it was before starting the subroutine. 11.1.5 program counter (pc) the program counter, a 16-bit register, contains the address of the next instruction to be executed. after reset, the program counter is initialized from one of six possible vectors, depending on operating mode and the cause of reset. 11.1.6 condition code register (ccr) this 8-bit register contains ?e condition code indicators (c, v, z, n, and h), two interrupt masking bits, (irq and xirq) and a stop disable bit (s). in the m68hc11 cpu, condition codes are automatically updated by most instructions. for example, load accumulator a (ldaa) and store accumulator a (staa) instructions automatically set or clear the n, z, and v condition code ?gs. pushes, pulls, add b to x (abx), add b to y (aby), and transfer/exchange instructions do not affect the condition codes. refer to table 11-2, which shows the condition codes that are affected by a particular instruction. table 11-1 reset vector comparison por or reset pin clock monitor cop watchdog normal $fffe, $ffff $fffc, $fffd $fffa, $fffb test or boot $bffe, $bfff $bffe, $bfff $bffe, $bfff tpg 212
MC68HC11PH8 motorola 11-5 cpu core and instruction set 11 11.1.6.1 carry/borrow (c) the c-bit is set if the arithmetic logic unit (alu) performs a carry or borrow during an arithmetic operation. the c-bit also acts as an error ?g for multiply and divide operations. shift and rotate instructions operate with and through the carry bit to facilitate multiple-word shift operations. 11.1.6.2 over?w (v) the over?w bit is set if an operation causes an arithmetic over?w. otherwise, the v-bit is cleared. 11.1.6.3 zero (z) the z-bit is set if the result of an arithmetic, logic, or data manipulation operation is zero. otherwise, the z-bit is cleared. compare instructions do an internal implied subtraction and the condition codes, including z, re?ct the results of that subtraction. a few operations (inx, dex, iny, and dey) affect the z-bit and no other condition ?gs. for these operations, only = and 1 conditions can be determined. 11.1.6.4 negative (n) the n-bit is set if the result of an arithmetic, logic, or data manipulation operation is negative; otherwise, the n-bit is cleared. a result is said to be negative if its most signi?ant bit (msb) is set (msb = 1). a quick way to test whether the contents of a memory location has the msb set is to load it into an accumulator and then check the status of the n-bit. 11.1.6.5 interrupt mask (i) the interrupt request (irq) mask (i-bit) is a global mask that disables all maskable interrupt sources. while the i-bit is set, interrupts can become pending, but the operation of the cpu continues uninterrupted until the i-bit is cleared. after any reset, the i-bit is set by default and can only be cleared by a software instruction. when an interrupt is recognized, the i-bit is set after the registers are stacked, but before the interrupt vector is fetched. after the interrupt has been serviced, a return from interrupt instruction is normally executed, restoring the registers to the values that were present before the interrupt occurred. normally, the i-bit is zero after a return from interrupt is executed. although the i-bit can be cleared within an interrupt service routine, ?esting interrupts in this way should only be done when there is a clear understanding of latency and of the arbitration mechanism. refer to section 10. tpg 213
motorola 11-6 MC68HC11PH8 cpu core and instruction set 11 11.1.6.6 half carry (h) the h-bit is set when a carry occurs between bits 3 and 4 of the arithmetic logic unit during an add, aba, or adc instruction. otherwise, the h-bit is cleared. half carry is used during bcd operations. 11.1.6.7 x interrupt mask (x) the xirq mask (x) bit disables interrupts from the xirq pin. after any reset, x is set by default and must be cleared by a software instruction. when an xirq interrupt is recognized, the x- and i-bits are set after the registers are stacked, but before the interrupt vector is fetched. after the interrupt has been serviced, an rti instruction is normally executed, causing the registers to be restored to the values that were present before the interrupt occurred. the x interrupt mask bit is set only by hardware reset or xirq acknowledge). x is cleared only by program instruction (tap, where the associated bit of a is 0; or rti, where bit 6 of the value loaded into the ccr from the stack has been cleared). there is no hardware action for clearing x. 11.1.6.8 stop disable (s) setting the stop disable (s) bit prevents the stop instruction from putting the m68hc11 into a low-power stop condition. if the stop instruction is encountered by the cpu while the s-bit is set, it is treated as a no-operation (nop) instruction, and processing continues to the next instruction. s is set by reset ?stop disabled by default. 11.2 data types the m68hc11 cpu supports the following data types: bit data 8-bit and 16-bit signed and unsigned integers 16-bit unsigned fractions 16-bit addresses a byte is eight bits wide and can be accessed at any byte location. a word is composed of two consecutive bytes with the most signi?ant byte at the lower value address. because the m68hc11 is an 8-bit cpu, there are no special requirements for alignment of instructions or operands. tpg 214
MC68HC11PH8 motorola 11-7 cpu core and instruction set 11 11.3 opcodes and operands the m68hc11 family of microcontrollers uses 8-bit opcodes. each opcode identi?s a particular instruction and associated addressing mode to the cpu. several opcodes are required to provide each instruction with a range of addressing capabilities. only 256 opcodes would be available if the range of values were restricted to the number able to be expressed in 8-bit binary numbers. a four-page opcode map has been implemented to expand the number of instructions. an additional byte, called a prebyte, directs the processor from page 0 of the opcode map to one of the other three pages. as its name implies, the additional byte precedes the opcode. a complete instruction consists of a prebyte, if any, an opcode, and zero, one, two, or three operands. the operands contain information the cpu needs for executing the instruction. complete instructions can be from one to ?e bytes long. 11.4 addressing modes six addressing modes; immediate, direct, extended, indexed, inherent, and relative, detailed in the following paragraphs, can be used to access memory. all modes except inherent mode use an effective address. the effective address is the memory address from which the argument is fetched or stored, or the address from which execution is to proceed. the effective address can be speci?d within an instruction, or it can be calculated. 11.4.1 immediate (imm) in the immediate addressing mode an argument is contained in the byte(s) immediately following the opcode. the number of bytes following the opcode matches the size of the register or memory location being operated on. there are two, three, and four (if prebyte is required) byte immediate instructions. the effective address is the address of the byte following the instruction. 11.4.2 direct (dir) in the direct addressing mode, the low-order byte of the operand address is contained in a single byte following the opcode, and the high-order byte of the address is assumed to be $00. addresses $00?ff are thus accessed directly, using two-byte instructions. execution time is reduced by eliminating the additional memory access required for the high-order address byte. in most applications, this 256-byte area is reserved for frequently referenced data. in m68hc11 mcus, the memory map can be con?ured for combinations of internal registers, ram, or external memory to occupy these addresses. tpg 215
motorola 11-8 MC68HC11PH8 cpu core and instruction set 11 11.4.3 extended (ext) in the extended addressing mode, the effective address of the argument is contained in two bytes following the opcode byte. these are three-byte instructions (or four-byte instructions if a prebyte is required). one or two bytes are needed for the opcode and two for the effective address. 11.4.4 indexed (ind, x; ind, y) in the indexed addressing mode, an 8-bit unsigned offset contained in the instruction is added to the value contained in an index register (ix or iy) ?the sum is the effective address. this addressing mode allows referencing any memory location in the 64kbyte address space. these are two- to ?e-byte instructions, depending on whether or not a prebyte is required. 11.4.5 inherent (inh) in the inherent addressing mode, all the information necessary to execute the instruction is contained in the opcode. operations that use only the index registers or accumulators, as well as control instructions with no arguments, are included in this addressing mode. these are one or two-byte instructions. 11.4.6 relative (rel) the relative addressing mode is used only for branch instructions. if the branch condition is true, an 8-bit signed offset included in the instruction is added to the contents of the program counter to form the effective branch address. otherwise, control proceeds to the next instruction. these are usually two-byte instructions. 11.5 instruction set refer to table 11-2, which shows all the m68hc11 instructions in all possible addressing modes. for each instruction, the table shows the operand construction, the number of machine code bytes, and execution time in cpu e clock cycles. tpg 216
MC68HC11PH8 motorola 11-9 cpu core and instruction set 11 table 11-2 instruction set (sheet 1 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c aba add accumulators a + b t a inh 1b ? 2 ? ? d ? dddd abx add b to x ix + (00:b) t ix inh 3a ? 3 ? ? ? ? ? ? ? ? aby add b to y iy + (00:b) t iy inh 18 3a ? 4 ? ? ? ? ? ? ? ? adca (opr) add with carry to a a + m + c t a a imm a dir a ext a ind, x a ind, y 89 99 b9 a9 18 a9 ii dd hh ll ff ff 2 3 4 4 5 ?? d ? dddd adcb (opr) add with carry to b b + m + c t b b imm b dir b ext b ind, x b ind, y c9 d9 f9 e9 18 e9 ii dd hh ll ff ff 2 3 4 4 5 ?? d ? dddd adda (opr) add memory to a a + m t a a imm a dir a ext a ind, x a ind, y 8b 9b bb ab 18 ab ii dd hh ll ff ff 2 3 4 4 5 ?? d ? dddd addb (opr) add memory to b b + m t b b imm b dir b ext b ind, x b ind, y cb db fb eb 18 eb ii dd hh ll ff ff 2 3 4 4 5 ?? d ? dddd addd (opr) add 16-bit to d d + (m:m+1) t d imm dir ext ind, x ind, y c3 d3 f3 e3 18 e3 jj kk dd hh ll ff ff 4 5 6 6 7 ???? dddd anda (opr) and a with memory a m t a a imm a dir a ext a ind, x a ind, y 84 94 b4 a4 18 a4 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? andb (opr) and b with memory b m t b b imm b dir b ext b ind, x b ind, y c4 d4 f4 e4 18 e4 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? asl (opr) arithmetic shift left ext ind, x ind, y 78 68 18 68 hh ll ff ff 6 6 7 ???? dddd asla arithmetic shift left a a inh 48 ? 2 ? ? ? ? dddd aslb arithmetic shift left b b inh 58 ? 2 ? ? ? ? dddd asld arithmetic shift left d inh 05 ? 3 ? ? ? ? dddd asr arithmetic shift right ext ind, x ind, y 77 67 18 67 hh ll ff ff 6 6 7 ???? dddd asra arithmetic shift right a a inh 47 ? 2 ? ? ? ? dddd asrb arithmetic shift right b b inh 57 ? 2 ? ? ? ? dddd bcc (rel) branch if carry clear c = 0 ? rel 24 rr 3 ? ? ? ? ? ? ? ? bclr (opr) (msk) clear bit(s) m (mm ) t m dir ind, x ind, y 15 1d 18 1d dd mm ff mm ff mm 6 7 8 ???? dd 0? bcs (rel) branch if carry set c = 1 ? rel 25 rr 3 ? ? ? ? ? ? ? ? beq (rel) branch if equal to zero z = 1 ? rel 27 rr 3 ? ? ? ? ? ? ? ? bge (rel) branch if 3 zero n ? v = 0 ? rel 2c rr 3 ? ? ? ? ? ? ? ? bgt (rel) branch if > zero z + (n ? v) = 0 ? rel 2e rr 3 ? ? ? ? ? ? ? ? bhi (rel) branch if higher c + z = 0 ? rel 22 rr 3 ? ? ? ? ? ? ? ? b7 b0 c 0 b15 b0 c 0 b7 b0 c tpg 217
motorola 11-10 MC68HC11PH8 cpu core and instruction set 11 bhs (rel) branch if higher or same c = 0 ? rel 24 rr 3 ? ? ? ? ? ? ? ? bita (opr) bit(s) test a with memory a m a imm a dir a ext a ind, x a ind, y 85 95 b5 a5 18 a5 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? bitb (opr) bit(s) test b with memory b m b imm b dir b ext b ind, x b ind, y c5 d5 f5 e5 18 e5 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? ble (rel) branch if zero z + (n ? v) = 1 ? rel 2f rr 3 ? ? ? ? ? ? ? ? blo (rel) branch if lower c = 1 ? rel 25 rr 3 ? ? ? ? ? ? ? ? bls (rel) branch if lower or same c + z = 1 ? rel 23 rr 3 ? ? ? ? ? ? ? ? blt (rel) branch if < zero n ? v = 1 ? rel 2d rr 3 ? ? ? ? ? ? ? ? bmi (rel) branch if minus n = 1 ? rel 2b rr 3 ? ? ? ? ? ? ? ? bne (rel) branch if 1 zero z = 0 ? rel 26 rr 3 ? ? ? ? ? ? ? ? bpl(rel) branch if plus n = 0 ? rel 2a rr 3 ? ? ? ? ? ? ? ? bra (rel) branch always 1 = 1 ? rel 20 rr 3 ? ? ? ? ? ? ? ? brclr(opr) (msk) (rel) branch if bit(s) clear m mm = 0 ? dir ind, x ind, y 13 1f 18 1f dd mm rr ff mm rr ff mm rr 6 7 8 ???????? brn (rel) branch never 1 = 0 ? rel 21 rr 3 ? ? ? ? ? ? ? ? brset(opr) (msk) (rel) branch if bit(s) set m mm = 0 ? dir ind, x ind, y 12 1e 18 1e dd mm rr ff mm rr ff mm rr 6 7 8 ???????? bset (opr) (msk) set bit(s) m + mm t m dir ind, x ind, y 14 1c 18 1c dd mm ff mm ff mm 6 7 8 ???? dd 0? bsr (rel) branch to subroutine see figure 11-2 rel 8d rr 6 ? ? ? ? ? ? ? ? bvc (rel) branch if over?ow clear v = 0 ? rel 28 rr 3 ? ? ? ? ? ? ? ? bvs (rel) branch if over?ow set v = 1 ? rel 29 rr 3 ? ? ? ? ? ? ? ? cba compare a with b a e b inh 11 ? 2 ? ? ? ? dddd clc clear carry bit 0 t c inh 0c ? 2 ??????? 0 cli clear interrupt mask 0 t i inh 0e ? 2 ? ? ? 0 ? ? ? ? clr (opr) clear memory byte 0 t m dir ind, x ind, y 7f 6f 18 6f hh ll ff ff 6 6 7 ????0100 clra clear accumulator a 0 t a a inh 4f ? 2 ????0100 clrb clear accumulator b 0 t b b inh 5f ? 2 ????0100 clv clear over?ow ?ag 0 t v inh 0a ? 2 ? ? ? ? ? ? 0 ? cmpa (opr) compare a with memory a e m a imm a dir a ext a ind, x a ind, y 81 91 b1 a1 18 a1 ii dd hh ll ff ff 2 3 4 4 5 ???? dddd cmpb (opr) compare b with memory b e m b imm b dir b ext b ind, x b ind, y c1 d1 f1 e1 18 e1 ii dd hh ll ff ff 2 3 4 4 5 ???? dddd com (opr) ones complement memory byte $ff e m t m ext ind, x ind, y 73 63 18 63 hh ll ff ff 6 6 7 ???? dd 01 coma ones complement a $ff e a t a a inh 43 ? 2 ? ? ? ? dd 01 comb ones complement b $ff e b t b b inh 53 ? 2 ? ? ? ? dd 01 table 11-2 instruction set (sheet 2 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c tpg 218
MC68HC11PH8 motorola 11-11 cpu core and instruction set 11 cpd (opr) compare d with memory (16-bit) d e (m:m+1) imm dir ext ind, x ind, y 1a 83 1a 93 1a b3 1a a3 cd a3 jj kk dd hh ll ff ff 5 6 7 7 7 ???? dddd cpx (opr) compare ix with memory (16-bit) ix e (m:m+1) imm dir ext ind, x ind, y 8c 9c bc ac cd ac jj kk dd hh ll ff ff 4 5 6 6 7 ???? dddd cpy (opr) compare iy with memory (16-bit) iy e (m:m+1) imm dir ext ind, x ind, y 18 8c 18 9c 18 bc 1a ac 18 ac jj kk dd hh ll ff ff 5 6 7 7 7 ???? dddd daa decimal adjust a adjust sum to bcd inh 19 ? 2 ? ? ? ? dd ? d dec (opr) decrement memory byte m e 1 t m ext ind, x ind, y 7a 6a 18 6a hh ll ff ff 6 6 7 ???? ddd ? deca decrement accumulator a a e 1 t a a inh 4a ? 2 ? ? ? ? ddd ? decb decrement accumulator b b e 1 t b b inh 5a ? 2 ? ? ? ? ddd ? des decrement stack pointer sp e 1 t sp inh 34 ? 3 ? ? ? ? ? ? ? ? dex decrement index register x ix e 1 t ix inh 09 ? 3 ? ? ? ? ? d ?? dey decrement index register y iy e 1 t iy inh 18 09 ? 4 ? ? ? ? ? d ?? eora (opr) exclusive or a with memory a ? m t a a imm a dir a ext a ind, x a ind, y 88 98 b8 a8 18 a8 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? eorb (opr) exclusive or b with memory b ? m t a b imm b dir b ext b ind, x b ind, y c8 d8 f8 e8 18 e8 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? fdiv fractional divide, 16 by 16 d / ix t ix; r t d inh 03 ? 41 ? ? ? ? ? ddd idiv integer divide, 16 by 16 d / ix t ix; r t d inh 02 ? 41 ? ? ? ? ? d 0 d inc (opr) increment memory byte m + 1 t m ext ind, x ind, y 7c 6c 18 6c hh ll ff ff 6 6 7 ???? ddd ? inca increment accumulator a a + 1 t a a inh 4c ? 2 ? ? ? ? ddd ? incb increment accumulator b b + 1 t b b inh 5c ? 2 ? ? ? ? ddd ? ins increment stack pointer sp + 1 t sp inh 31 ? 3 ? ? ? ? ? ? ? ? inx increment index register x ix + 1 t ix inh 08 ? 3 ? ? ? ? ? d ?? iny increment index register y iy + 1 t iy inh 18 08 ? 4 ? ? ? ? ? d ?? jmp (opr) jump see figure 11-2 ext ind, x ind, y 7e 6e 18 6e hh ll ff ff 3 3 4 ???????? jsr (opr) jump to subroutine see figure 11-2 dir ext ind, x ind, y 9d bd ad 18 ad dd hh ll ff ff 5 6 6 7 ???????? ldaa (opr) load accumulator a m t a a imm a dir a ext a ind, x a ind, y 86 96 b6 a6 18 a6 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? table 11-2 instruction set (sheet 3 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c tpg 219
motorola 11-12 MC68HC11PH8 cpu core and instruction set 11 ldab (opr) load accumulator b m t b b imm b dir b ext b ind, x b ind, y c6 d6 f6 e6 18 e6 ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? ldd (opr) load double accumulator d m t a; m+1 t b imm dir ext ind, x ind, y cc dc fc ec 18 ec jj kk dd hh ll ff ff 3 4 5 5 6 ???? dd 0? lds (opr) load stack pointer m:m+1 t sp imm dir ext ind, x ind, y 8e 9e be ae 18 ae jj kk dd hh ll ff ff 3 4 5 5 6 ???? dd 0? ldx (opr) load index register x m:m+1 t ix imm dir ext ind, x ind, y ce de fe ee cd ee jj kk dd hh ll ff ff 3 4 5 5 6 ???? dd 0? ldy (opr) load index register y m:m+1 t iy imm dir ext ind, x ind, y 18 ce 18 de 18 fe 1a ee 18 ee jj kk dd hh ll ff ff 4 5 6 6 6 ???? dd 0? lsl (opr) logical shift left ext ind, x ind, y 78 68 18 68 hh ll ff ff 6 6 7 ???? dddd lsla logical shift left a a inh 48 ? 2 ? ? ? ? dddd lslb logical shift left b b inh 58 ? 2 ? ? ? ? dddd lsld logical shift left d inh 05 ? 3 ? ? ? ? dddd lsr (opr) logical shift right ext ind, x ind, y 74 64 18 64 hh ll ff ff 6 6 7 ???? 0 ddd lsra logical shift right a a inh 44 ? 2 ? ? ? ? 0 ddd lsrb logical shift right b b inh 54 ? 2 ? ? ? ? 0 ddd lsrd logical shift right d inh 04 ? 3 ? ? ? ? 0 ddd mul multiply, 8 x 8 a * b t d inh 3d ? 10 ? ? ? ? ? ? ? d neg (opr) twos complement memory byte 0 e m t m ext ind, x ind, y 70 60 18 60 hh ll ff ff 6 6 7 ???? dddd nega twos complement a 0 e a t a a inh 40 ? 2 ? ? ? ? dddd negb twos complement b 0 e b t b b inh 50 ? 2 ? ? ? ? dddd nop no operation no operation inh 01 ? 2 ? ? ? ? ? ? ? ? oraa or accumulator a (inclusive) a + m t a a imm a dir a ext a ind, x a ind, y 8a 9a ba aa 18 aa ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? orab or accumulator b (inclusive) b + m t b b imm b dir b ext b ind, x b ind, y ca da fa ea 18 ea ii dd hh ll ff ff 2 3 4 4 5 ???? dd 0? psha push a onto stack a t stack; sp = spe1 a inh 36 ? 3 ? ? ? ? ? ? ? ? pshb push b onto stack b t stack; sp = spe1 b inh 37 ? 3 ? ? ? ? ? ? ? ? pshx push ix onto stack (low trst) ix t stack; sp = spe2 inh 3c ? 4 ? ? ? ? ? ? ? ? pshy push iy onto stack (low trst) iy t stack; sp = spe2 inh 18 3c ? 5 ? ? ? ? ? ? ? ? table 11-2 instruction set (sheet 4 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c b7 b0 c 0 b15 b0 c 0 b7 b0 0 c b15 b0 0 c tpg 220
MC68HC11PH8 motorola 11-13 cpu core and instruction set 11 pula pull a from stack sp = sp+1; stack t a a inh 32 ? 4 ???????? pulb pull b from stack sp = sp+1; stack t b b inh 33 ? 4 ???????? pulx pull ix from stack (high trst) sp = sp+2; stack t ix inh 38 ? 5 ? ? ? ? ? ? ? ? puly pull iy from stack (high trst) sp = sp+2; stack t iy inh 18 38 ? 6 ? ? ? ? ? ? ? ? rol (opr) rotate left ext ind, x ind, y 79 69 18 69 hh ll ff ff 6 6 7 ???? dddd rola rotate left a a inh 49 ? 2 ? ? ? ? dddd rolb rotate left b b inh 59 ? 2 ? ? ? ? dddd ror (opr) rotate right ext ind, x ind, y 76 66 18 66 hh ll ff ff 6 6 7 ???? dddd rora rotate right a a inh 46 ? 2 ? ? ? ? dddd rorb rotate right b b inh 56 ? 2 ? ? ? ? dddd rti return from interrupt see figure 11-2 inh 3b ? 12 ddddddd rts return from subroutine see figure 11-2 inh 39 ? 5 ? ? ? ? ? ? ? ? sba subtract b from a a e b t a inh 10 ? 2 ? ? ? ? dddd sbca (opr) subtract with carry from a a e m e c t a a imm a dir a ext a ind, x a ind, y 82 92 b2 a2 18 a2 ii dd hh ll ff ff 2 3 4 4 5 ???? dddd sbcb (opr) subtract with carry from b b e m e c t b b imm b dir b ext b ind, x b ind, y c2 d2 f2 e2 18 e2 ii dd hh ll ff ff 2 3 4 4 5 ???? dddd sec set carry 1 t c inh 0d ? 2 ? ? ? ? ? ? ? 1 sei set interrupt mask 1 t i inh 0f ? 2 ? ? ? 1 ? ? ? ? sev set over?ow ?ag 1 t v inh 0b ? 2 ? ? ? ? ? ? 1 ? staa (opr) store accumulator a a t m a dir a ext a ind, x a ind, y 97 b7 a7 18 a7 dd hh ll ff ff 3 4 4 5 ???? dd 0? stab (opr) store accumulator b b t m b dir b ext b ind, x b ind, y d7 f7 e7 18 e7 dd hh ll ff ff 3 4 4 5 ???? dd 0? std (opr) store accumulator d a t m; b t m+1 dir ext ind, x ind, y dd fd ed 18 ed dd hh ll ff ff 4 5 5 6 ???? dd 0? stop stop internal clocks ? inh cf ? 2 ? ? ? ? ? ? ? ? sts (opr) store stack pointer sp t m:m+1 dir ext ind, x ind, y 9f bf af 18 af dd hh ll ff ff 4 5 5 6 ???? dd 0? stx (opr) store index register x ix t m:m+1 dir ext ind, x ind, y df ff ef cd ef dd hh ll ff ff 4 5 5 6 ???? dd 0? sty (opr) store index register y iy t m:m+1 dir ext ind, x ind, y 18 df 18 ff 1a ef 18 ef dd hh ll ff ff 5 6 6 6 ???? dd 0? table 11-2 instruction set (sheet 5 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c b7 b0 c b7 b0 c tpg 221
motorola 11-14 MC68HC11PH8 cpu core and instruction set 11 suba (opr) subtract memory from a a e m t a a imm a dir a ext a ind, x a ind, y 80 90 b0 a0 18 a0 ii dd hh ll ff ff 2 3 4 4 5 ???? dddd subb (opr) subtract memory from b b e m t b b imm b dir b ext b ind, x b ind, y c0 d0 f0 e0 18 e0 ii dd hh ll ff ff 2 3 4 4 5 ???? dddd subd (opr) subtract memory from d d e m:m+1 t d imm dir ext ind, x ind, y 83 93 b3 a3 18 a3 jj kk dd hh ll ff ff 4 5 6 6 7 ???? dddd swi software interrupt see figure 11-2 inh 3f ? 14 ? ? ? 1 ? ? ? ? tab transfer a to b a t b inh 16 ? 2 ? ? ? ? dd 0? tap transfer a to cc register a t ccr inh 06 ? 2 ddddddd tba transfer b to a b t a inh 17 ? 2 ? ? ? ? dd 0? test test (only in test modes) address bus increments inh 00 ? ? ? ? ? ? ? ? ? ? tpa transfer cc register to a ccr t a inh 07 ? 2 ? ? ? ? ? ? ? ? tst (opr) test for zero or minus m e 0 ext ind, x ind, y 7d 6d 18 6d hh ll ff ff 6 6 7 ???? dd 00 tsta test a for zero or minus a e 0 a inh 4d ? 2 ? ? ? ? dd 00 tstb test b for zero or minus b e 0 b inh 5d ? 2 ? ? ? ? dd 00 tsx transfer stack pointer to x sp + 1 t ix inh 30 ? 3 ? ? ? ? ? ? ? ? tsy transfer stack pointer to y sp + 1 t iy inh 18 30 ? 4 ???????? txs transfer x to stack pointer ix e 1 t sp inh 35 ? 3 ? ? ? ? ? ? ? ? tys transfer y to stack pointer iy e 1 t sp inh 18 35 ? 4 ? ? ? ? ? ? ? ? wai wait for interrupt stack registers & wait inh 3e ? ? ? ? ? ? ? ? ? xgdx exchange d with x ix t d; d t ix inh 8f ? 3 ? ? ? ? ? ? ? ? xgdy exchange d with y iy t d; d t iy inh 18 8f ? 4 ? ? ? ? ? ? ? ? operators operands t is transferred to dd 8-bit direct address ($0000e$00ff); the high byte is assumed boolean and to be zero + arithmetic addition, except where used as an ff 8-bit positive offset ($00 to $ff (0 to 256)) is added to the inclusive-or symbol in boolean formulae contents of the index register ? exclusive-or hh high order byte of 16-bit extended address * multiply ii one byte of immediate data : concatenation jj high order byte of 16-bit immediate data e arithmetic subtraction, or negation symbol kk low order byte of 16-bit immediate data (twos complement) ll low order byte of 16-bit extended address mm 8-bit mask (set bits to be affected) rr signed relative offset ($80 to $7f (e128 to +127)); offset is relative to the address following the offset byte cycles condition codes ? intnite, or until reset occurs ? bit not changed 12 cycles are used, beginning with the opcode 0 bit always cleared fetch. a wait state is entered, which remains 1 bit always set in effect for an integer number of mpu e clock d bit set or cleared, depending on the operation cycles (n) until an interrupt is recognised. bit can be cleared, but cannot become set finally, two additional cycles are used to fetch ? not detned the appropriate interrupt vector. (14 + n, total). table 11-2 instruction set (sheet 6 of 6) mnemonic operation description addressing mode instruction condition codes opcode operand cycles s x h i n z v c tpg 222
MC68HC11PH8 motorola a-1 electrical specifications (standard) 12 a electrical specifications (standard) this section contains the electrical speci?ations and associated timing information for the standard supply voltage (v dd = 5v 10%) MC68HC11PH8 variants. 1.1 maximum ratings note: this device contains circuitry designed to protect against damage due to high electrostatic voltages or electric ?lds. however, it is recommended that normal precautions be taken to avoid the application of any voltages higher than those given in the maximum ratings table to this high impedance circuit. for maximum reliability all unused inputs should be tied to either v ss or v dd . 1.2 thermal characteristics and power considerations the average chip junction temperature, t j , in degrees celsius can be obtained from the following equation: (1) all voltages are with respect to v ss . (2) maximum current drain per pin is for one pin at a time, observing maximum power dissipation limits. rating symbol value unit supply voltage (1) v dd e 0.3 to +7.0 v input voltage (1) v in e 0.3 to +7.0 v operating temperature range e MC68HC11PH8, mc68hc711ph8 t a t l to t h e40 to +85 c storage temperature range t stg e 55 to +150 c current drain per pin (2) e not vdd, vss, vdd ad, vss ad, vrh or vrl i d 25 ma tpg 223
motorola a-2 MC68HC11PH8 electrical specifications (standard) 12 [1] where: t a = ambient temperature ( c) q ja = package thermal resistance, junction-to-ambient ( c/w) p d = total power dissipation = p int + p i/o (w) p int = internal chip power = i dd ?v dd (w) p i/o = power dissipation on input and output pins (user determined) an approximate relationship between p d and t j (if p i/o is neglected) is: [2] solving equations [1] and [2] for k gives: [3] where k is a constant for a particular part. k can be determined by measuring p d (at equilibrium) for a known t a . using this value of k, the values of p d and t j can be obtained for any value of t a , by solving the above equations. the package thermal characteristics are shown below: characteristics symbol value unit thermal resistance e 84-pin plcc package e 84-pin cerquad package (eprom) e 112-pin qfp package q ja 50 50 tbd c/w t j t a p d q ja () + = p d k t j 273 + --------------------- = kp d t a 273 + () q ja p d 2 + = tpg 224
MC68HC11PH8 motorola a-3 electrical specifications (standard) 12 1.3 test methods figure a-1 test methods ~v dd 0.4v v dd e 0.8v 0.4v nominal nominal ~v ss 70% of v dd 20% of v dd nominal timing ~v dd ~v ss v dd e 0.8v 0.4v clocks, strobes inputs outputs ~v dd 20% of v dd spec. spec. ~v ss 70% of v dd 20% of v dd spec. timing ~v dd ~v ss clocks, strobes inputs outputs (b) dc testing (c) ac testing 20% of v dd 70% of v dd v dd e 0.8v (2) 0.4v (2) 70% of v dd 20% of v dd notes: (1) full test loads are applied during all dc electrical tests and ac timing measurements. (2) during ac timing measurements, inputs are driven to 0.4v and v dd e 0.8v; timing measurements are taken at the 20% and 70% of v dd points. tpg 225
motorola a-4 MC68HC11PH8 electrical specifications (standard) 12 1.4 dc electrical characteristics (1) v oh specitcation for reset and moda is not applicable as they are open-drain pins. v oh specitcation is not applicable to port c, port d and port g[5:0] in wired-or mode. (2) refer to a/d specitcation for the leakage current value for port e. (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted) characteristic symbol min. max. unit output voltage (1) ( i load = 10 m a ): all outputs except xtal all outputs except xtal, reset & moda v ol v oh ? v dd e 0.1 0.1 ? v v output high voltage (1) ( i load = e0.8ma, v dd =4.5v ): all outputs except xtal, reset & moda v oh v dd e 0.8 ? v output low voltage ( i load = +1.6ma ): all outputs except xtal v ol ? 0.4 v input high voltage: all inputs except reset reset v ih 0.7v dd 0.8v dd v dd + 0.3 v dd + 0.3 v input low voltage e all inputs v il v ss e 0.3 0.2v dd v i/o ports three-state leakage ( v in = v ih or v il ) (2) : ports a, b, c, d, f, g, h, moda/lir , reset i oz ? 10 m a input leakage (2) ( v in = v dd or v ss ): modb/vstby irq , xirq (rom parts) xirq (eprom parts) i in ? ? ? 10 1 10 m a input current with pull-up resistors ( v in = v il ): ports b, c, f, g, h i ipr 20 100 m a ram stand-by voltage (power down) v sb 2.0 v dd v ram stand-by current (power down) i sb ?10 m a input capacitance: port e, irq , xirq , extal ports a, b, c, d, f, g, h, moda/lir , reset c in ? ? 8 12 pf output load capacitance: all outputs except pd[4:1], pg[4:1], xtal, moda/lir pd[4:1], pg[4:1] c l ? ? 90 200 pf tpg 226
MC68HC11PH8 motorola a-5 electrical specifications (standard) 12 a.4.1 dc electrical characteristics ?modes of operation (1) all current measurements taken with suitable decoupling capacitors across the power supply to suppress the transient switching currents inherent in cmos designs. extal is driven with a square wave, with t cyc = 167ms for 6khz devices; 500/333/250ns for 2/3/4mhz devices. vil 0.2v; vih 3 vdd e 0.2v; no dc loads wait: all peripheral functions shut down stop: all clocks stopped (2) wait values in the 6 khz column obtained by using an external clock of 32 khz and the pll low-power wait mode (wen = 1). (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted) characteristic symbol 6khz 2mhz 3mhz 4mhz unit maximum total supply current (including pll) (1) : run: single chip mode run: expanded mode wait: single chip mode (2) stop: single chip mode i dd tbd tbd 500 50 27 35 500 50 32 42 500 50 40 50 500 50 ma ma m a m a maximum power dissipation: single chip mode maximum power dissipation: expanded mode p d tbd tbd 149 193 176 231 220 275 mw mw tpg 227
motorola a-6 MC68HC11PH8 electrical specifications (standard) 12 1.5 control timing (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. (2) reset is recognized during the trst clock cycle it is held low. internal circuitry then drives the pin low for eight clock c ycles, releases the pin and samples the pin level four cycles later to determine the source of the interrupt. (see section 10.) (3) to guarantee an external reset vector. (4) this is the minimum input time; it can be pre-empted by an internal reset. (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h ) characteristic (1) symbol 2.0mhz 3.0mhz 4.0mhz unit min. max. min. max. min. max. frequency of operation f op 0 2.0 0 3.0 0 4.0 mhz e clock period t cyc 500 ? 333 ? 250 ? ns crystal frequency f xtal ? 8.0 ? 12.0 ? 16.0 mhz external oscillator frequency 4f op 0 8.0 0 12.0 0 16.0 mhz processor control set-up time (t pcsu = t cyc /4 + 50ns) t pcsu 175 ? 133 ? 112 ? ns reset input pulse width (2) pw rstl (3) pw rstl (4) 16 1 ? ? 16 1 ? ? 16 1 ? ? t cyc mode programming set-up time t mps 2?2?2?t cyc mode programming hold time t mph 10?10?10?ns interrupt pulse width (irq edge sensitive mode) pw irq t cyc +20 ? t cyc +20 ? t cyc +20 ?ns timer pulse width (input capture and pulse accumulator inputs) pw tim t cyc +20 ? t cyc +20 ? t cyc +20 ?ns wait recovery start-up time t wrs ?4?4?4t cyc clock monitor reset f cmon 10 200 10 200 10 200 khz figure a-2 timer inputs pw tim notes pa[3:0] (2) pa[3:0] (1) pa7 (1), (3) pa7 (2), (3) (1) rising edge sensitive input. (2) falling edge sensitive input. (3) maximum pulse accumulator clocking rate is e clock frequency divided by two (e/2). tpg 228
MC68HC11PH8 motorola a-7 electrical specifications (standard) 12 figure a-3 reset timing figure a-4 interrupt timing ffff fffe fffe fffe fffe fffe new ffff fffe fffe fffe fffe pc new pc v dd extal e reset moda, address modb t pordelay (1) t pcsu pw rstl t mps t mph (1) t pordelay = 4064 t cyc (or 128 t cyc depending on mask option - MC68HC11PH8 only) va+1 va spe8 spe5 e clock address (3) oa notes: spe3 spe8 sp oa+1 r/w t pcsu spe7 spe4 spe2 spe1 new pc spe6 pw irq e e pcl pch iyl iyh op ixl ixh b a ccr e e vh vl op data (4) irq (1) irq (2) , xirq or internal interrupt (1) edge sensitive irq pin (irqe = 1). (2) level sensitive irq pin (irqe = 0). (3) where oa = opcode address and va = vector address. (4) where op = opcode, vh = vector (msb) and vl = vector (lsb). tpg 229
motorola a-8 MC68HC11PH8 electrical specifications (standard) 12 figure a-5 stop recovery timing figure a-6 wait recovery timing fff3 fff2 spe8 spe8 spe7 sp sa+2 new pc internal irq (1) e clock address (5) clocks sa+1 sa (6) sa+1 sa+1 sa (6) sa+1 op- code address (4) pw irq t stopdelay (3) irq (2) or xirq resume program with instruction which follows the stop instruction notes: (1) edge sensitive irq pin (irqe = 1). (2) level sensitive irq pin (irqe = 0). (4) xirq with x-bit in ccr = 1. (5) irq (or xirq , with x-bit = 0; in this case vector fetch will be $fff4/5). (6) sa = stop address. (3) if dly = 1: t stopdelay = 4064 t cyc (or 128 t cyc depending on mask option - MC68HC11PH8 only) if dly = 0: t stopdelay = 4 t cyc va+1 va (2) spe8 spe8 e clock address wa (1) wa+1 notes: reset also causes recovery from wait. (1) wa = wait address. (2) va = vector address. spe8 spe8spe8 spe8 spe2spe8 spe1 sp new pc irq , xirq , or internal interrupts r/w t pcsu t wrs stack registers tpg 230
MC68HC11PH8 motorola a-9 electrical specifications (standard) 12 a.5.1 peripheral port timing (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. (2) port c, d and g timing is valid for active drive (cwom, dwom, gwom, woms and woms2 bits clear). (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h ) characteristic (1) symbol 2.0mhz 3.0mhz 4.0mhz unit min. max. min. max. min. max. frequency of operation (e clock frequency) f op 0 2.0 0 3.0 0 4.0 mhz e clock period t cyc 500 ? 333 ? 250 ? ns peripheral data set-up time, all ports (2) t pdsu 100 ? 100 ? 100 ? ns peripheral data hold time, all ports (2) t pdh 50 ? 50 ? 50 ? ns delay time, peripheral data write mcu write to port a, b, g or h mcu write to port c, d or f (t pwd = t cyc /4 + 100ns) t pwd ? ? 200 225 ? ? 200 183 ? ? 200 162 ns figure a-7 port read timing diagram figure a-8 port write timing diagram mcu read of port e clock ports a, c, d, f ports t pdsu t pdh t pdsu t pdh b, e, g, h t pwd mcu write to port t pwd previous port data new data valid previous port data new data valid e clock ports c, d, f ports a, b, g, h tpg 231
motorola a-10 MC68HC11PH8 electrical specifications (standard) 12 a.5.2 pll control timing (1) this mask option does not exist on the mc68hc711ph8, on which the pll is optimized for use at 32khz. (2) assumes that stable vddsyn is applied, that an external tlter capacitor with a value of 47nf is attached to the xfc pin, and that the crystal oscillator is stable. stabilization time is measured from power-up to reset release. this specitcation also applies to the period required for pll stabilization after changing the x and y frequency control bits in the synthesizer control register (synr) while pll is running, and to the period required for the clock to stabilize after wait with wen = 1. (3) short term stability is the average deviation from programmed frequency measured over a 2 m s interval at maximum f sys , long term 4xclk stability is the average deviation from programmed frequency measured over a 1ms interval at maximum f sys . stability is measured with a stable external clock applied ? variation in crystal oscillator frequency is additive to this tgure. (4) this parameter is periodically sampled rather than 100% tested. (vdd = 5.0vdc 10%, vss = 0vdc, t a = t l to t h unless otherwise noted) characteristic symbol mask option 1 mask option 2 (1) units min typical maximum min typical maximum pll reference frequency f ref 25 32 50 50 614 2000 khz system frequency pll output frequency external clock operation f sys f vcoout f xtal dc 0.05 dc ? ? 4 16 16 dc 0.1 dc ? ? 4 16 16 mhz capacitor on pin xfc c xfc ?47 ? ? 47 ? nf pll stabilization time (2) t plls ? 20 tbd ? 10 tbd ms 4xclk stability (3)(4) short term long term c stab tbd tbd ? ? tbd tbd tbd tbd ? ? tbd tbd % tpg 232
MC68HC11PH8 motorola a-11 electrical specifications (standard) 12 a.5.3 analog-to-digital converter characteristics (1) for f op < 2mhz, source impedances should be approximately 10k w . for f op 3 2mhz, source impedances should be in the range 5e10k w . source impedances greater than 10k w have an adverse affect on a/d accuracy, because of input leakage. (2) performance verited down to d v r = 2.5v, however accuracy is tested and guaranteed at d v r = 5v 10%. (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , 750khz e 4mhz, unless otherwise noted) characteristic parameter min. absolute 2mhz (1) 3mhz (1) 4mhz (1) unit max. max. max. resolution number of bits resolved by adc ? 8 ? ? ? bits non-linearity maximum deviation from the ideal adc transfer characteristics ?? 0.5 1 1 lsb zero error difference from the output of an ideal adc for zero input voltage ?? 0.5 1 1 lsb full-scale error difference from the output of an ideal adc for full-scale input voltage ?? 0.5 1 1 lsb total unadjusted error maximum sum of non-linearity, zero and full-scale errors ?? 0.5 1.5 1.5 lsb quantization error uncertainty due to converter resolution ? ? 0.5 0.5 0.5 lsb absolute accuracy difference between the actual input voltage and the full-scale weighted equivalent of the binary output code, including all error sources ?? 1 2 2 lsb conversion range analog input voltage range v rl ?v rh v rh v rh v v rh analog reference voltage (high) (2) v rl ?v dd +0.1 v dd +0.1 v dd +0.1 v v rl analog reference voltage (low) (2) v ss e0.1 ? v rh v rh v rh v d v r minimum difference between v rh and v rl (2) 3 ? ???v conversion time total time to perform a single a/d conversion: e clock internal rc oscillator ? ? 32 ? ? t cyc +32 ? t cyc +32 ? t cyc +32 t cy c m s monotonicity conversion result never decreases with an increase in input voltage and has no missing codes guaranteed zero input reading conversion result when v in = v rl $00 ? ? ? ? hex full-scale reading conversion result when v in = v rh ? ? $ff $ff $ff hex sample acquisition time analog input acquisition sampling time: e clock internal rc oscillator ? ? 12 ? ? 12 ? 12 ? 12 t cy c m s sample/hold capacitance input capacitance (pe[0:7]) during sample ? 20 (typ) ? ? ? pf input leakage input leakage on a/d pins: pe[0:7] v rl , v rh ? ? ? ? 400 1.0 400 1.0 400 1.0 na m a tpg 233
motorola a-12 MC68HC11PH8 electrical specifications (standard) 12 a.5.4 serial peripheral interface timing (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. (2) signal production depends on software. (3) assumes 200pf load on all spi pins. (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h ) num characteristic (1) symbol 2.0mhz 3.0mhz 4.0mhz unit min. max. min. max. min. max. operating frequency master slave f op(m) f op(s) 0 0 0.5 2.0 0 0 0.5 3.0 0 0 0.5 4.0 f op mhz 1 cycle time master slave t cyc(m) t cyc(s) 2.0 500 ? ? 2.0 333 ? ? 2.0 250 ? ? t cyc ns 2 enable lead time (2) master slave t lead(m) t lead(s) ? 250 ? ? ? 240 ? ? ? 200 ? ? ns 3 enable lag time (2) master slave t lag(m) t lag(s) ? 250 ? ? ? 240 ? ? ? 200 ? ? ns 4 clock (sck) high time master slave t w(sckh)m t w(sckh)s 340 190 ? ? 227 127 ? ? 130 85 ? ? ns 5 clock (sck) low time master slave t w(sckl)m t w(sckl)s 340 190 ? ? 227 127 ? ? 130 85 ? ? ns 6 input data set-up time master slave t su(m) t su(s) 100 100 ? ? 100 100 ? ? 100 100 ? ? ns 7 input data hold time master slave t h(m) t h(s) 100 100 ? ? 100 100 ? ? 100 100 ? ? ns 8 access time (from high-z to data active) slave t a 0 120 0 120 0 120 ns 9 disable time (hold time to high-z state) slave t dis ? 300 ? 300 ? 300 ns 10 data valid (after enable edge) (3) t v(s) ? 240 ? 167 ? 125 ns 11 output data hold time (after enable edge) t ho 0?0?0?ns 12 rise time (3) spi outputs (sck, mosi and miso) spi inputs (sck, mosi, miso and ss ) t rm t rs ? ? 100 2.0 ? ? 100 2.0 ? ? 100 2.0 ns m s 13 fall time (3) spi outputs (sck, mosi and miso) spi inputs (sck, mosi, miso and ss ) t fm t fs ? ? 100 2.0 ? ? 100 2.0 ? ? 100 2.0 ns m s tpg 234
MC68HC11PH8 motorola a-13 electrical specifications (standard) 12 figure a-9 spi master timing (cpha = 0) figure a-10 spi master timing (cpha = 1) 1 ss (input) sck (cpol=0) (output) sck (cpol=1) (output) miso (input) mosi (output) (see note) (see note) ss is held high on master msb in lsb in bit 61 master msb out bit 61 master lsb out 13 12 13 5 4 4 5 7 11 10 12 13 6 10 (ref.) 11 (ref.) 12 note: this trst clock edge is generated internally, but is not seen at the sck pin. 1 ss (input) sck (cpol=0) (output) sck (cpol=1) (output) miso (input) mosi (output) (see note) ss is held high on master msb in lsb in bit 61 master msb out bit 61 master lsb out 12 13 12 5 4 4 5 11 10 12 13 10 (ref.) 11 (ref.) 13 note: this last clock edge is generated internally, but is not seen at the sck pin. (see note) 7 6 tpg 235
motorola a-14 MC68HC11PH8 electrical specifications (standard) 12 figure a-11 spi slave timing (cpha = 0) figure a-12 spi slave timing (cpha = 1) 1 ss (input) sck (cpol=0) (input) sck (cpol=1) (input) mosi (input) miso (output) msb in lsb in bit 61 slave msb out bit 61 slave lsb out 12 13 12 5 4 4 5 8 11 13 note: not detned, but normally the msb of character just received. 7 6 10 (see note) 9 3 2 1 ss (input) sck (cpol=0) (input) sck (cpol=1) (input) mosi (input) miso (output) msb in lsb in bit 61 slave msb out bit 61 slave lsb out 12 13 12 5 4 4 5 8 11 13 note: not detned, but normally the lsb of character last transmitted. 7 6 10 (see note) 9 3 2 tpg 236
MC68HC11PH8 motorola a-15 electrical specifications (standard) 12 a.5.5 non-multiplexed expansion bus timing (1) all timing is given with respect to 20% and 70% of v dd , unless otherwise noted. (2) input clock duty cycles other than 50% will affect the bus performance. (3) for f op 2mhz the following formulae may be used to calculate parameter values: pw el = t cyc /2 e 20ns pw eh = t cyc /2 e 25ns t ah = t cyc /8 e 10ns t ad = t cyc /8 + 40ns t av = pw el e t ad t dhw = t cyc /8 t acca = t cyc e t f e t dsr e t ad t dsw = pw eh e t ddw (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h ) num characteristic (1) symbol 2.0mhz 3.0mhz 4.0mhz unit min. max. min. max. min. max. frequency of operation (e clock frequency) f op 0 2.0 0 3.0 0 4.0 mhz 1 e clock period t cyc 500 ? 333 ? 250 ? ns 2 pulse width, e low (2), (3) pw el 230 ? 147 ? 105 ? ns 3 pulse width, e high (2), (3) pw eh 225 ? 142 ? 100 ? ns 4a 4b e clock rise time fall time t r t f ? ? 20 20 ? ? 20 18 ? ? 20 15 ns 9 address hold time (3) t ah 53?32?21?ns 11 address delay time (3) t ad ?103?82?71ns 12 address valid to e rise time (3) t av 127?65?34?ns 17 read data set-up time t dsr 30?30?20?ns 18 read data hold time t dhr 0?0?0?ns 19 write data delay time t ddw ?40?40?40ns 21 write data hold time (3) t dhw 63?42?31?ns 29 mpu address access time (3) t acca 348 ? 203 ? 144 ? ns 39 write data set-up time (3) t dsw 185 ? 102 ? 60 ? ns 57 address valid to data three-state time t avdz ?10?10?10ns tpg 237
motorola a-16 MC68HC11PH8 electrical specifications (standard) 12 a.5.6 eeprom characteristics a.5.7 eprom characteristics (1) the rc oscillator (rco) must be enabled (by setting the csel bit in the option register) for eeprom programming and erasure when the e clock frequency is less than 1.0mhz. (2) refer to the current issue of motorola?s quarterly reliability monitor report for the latest failure rate information. figure a-13 expansion bus timing characteristic temperature range unit e40 to +85 c programming time, t eeprog (1) <1mhz, rco enabled 1e2mhz, rco disabled 3 2mhz & whenever rco enabled 10 20 10 ms erase time: byte, row and bulk (1) 10 ms write/erase endurance (2) 10000 cycles data retention (2) 10 years (v dd = 5.0 vdc 10%, v ss = 0 vdc, t a = t l to t h , unless otherwise noted) characteristic symbol min max unit programming voltage v ppe 12 12.75 v programming voltage detect level v pph tbd tbd v programming time t eprog ? ms e clock r/w , address data (read) data (write) 1 2 3 4b 4a 12 11 9 18 21 39 17 29 57 19 tpg 238
MC68HC11PH8 motorola b-1 mechanical data and ordering information 13 b mechanical data and ordering information b.1 pin assignments the MC68HC11PH8 is available in 84-pin plcc or 112-pin tqfp packages; in addition to those two packages, the mc68hc711ph8 is available in a windowed 84-pin cerquad package, to allow full use of the eprom. figure b-1 84-pin plcc/ cerquad pinout pb0/a8 pb1/a9 pb2/a10 pb3/a11 pb4/a12/lcd4 pb5/a13/lcd5 pb6/a14/lcd6 pb7/a15/lcd7 vss vdd pa0/ic3 pa1/ic2 pa2/ic1 pa3/oc1/oc5/ic4 pa4/oc1/oc4 pa5/oc1/oc3 pa6/oc1/oc2 pa7/oc1/pai pd5/ss pd4/sck pd3/mosi rxd2/pg0 vdd ad ad7/pe7 ad6/pe6 ad5/pe5 ad4/pe4 ad3/pe3 ad2/pe2 ad1/pe1 ad0/pe0 vrl vrh vss ad a7/pf7 a6/pf6 a5/pf5 a4/pf4 a3/pf3 a2/pf2 a1/pf1 a0/pf0 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 56 55 54 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 11 10 9 8 7 6 5 4 3 2 84 83 82 81 80 79 78 77 76 75 pd2/miso pd1/txd1 pd0/rxd1 moda/lir reset xfc vddsyn extal xtal e vddr vssr pc7/d7 pc6/d6 pc5/d5 pc4/d4 pc3/d3 pc2/d2 pc1/d1 pc0/d0 irq pw1/ph0 pw2/ph1 pw3/ph2 pw4/ph3 ph4 ph5 ph6 ph7 modb/vstby vppe /xirq vdd vddl vssl vss r/w /pg7 lcdbp/pg6 ss2 /pg5 sck2/pg4 mosi2/pg3 miso2/pg2 txd2/pg1 tpg 239
motorola b-2 MC68HC11PH8 mechanical data and ordering information 13 figure b-2 112-pin tqfp pinout 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 84 83 82 81 80 79 78 77 76 75 74 73 72 71 70 69 68 67 66 65 64 63 62 61 60 59 58 57 111 110 109 108 107 106 105 104 103 102 101 100 99 98 97 96 95 94 93 92 91 90 89 88 87 86 nc nc pw1/ph0 pw2/ph1 pw3/ph2 pw4/ph3 ph4 ph5 ph6 ph7 nc modb/vstby vppe /xirq nc vddl vssl nc nc r/w /pg7 lcdbp/pg6 ss2 /pg5 sck2/pg4 mosi2/pg3 miso2/pg2 txd2/pg1 nc nc nc rxd2/pg0 nc nc vddad ad7/pe7 ad6/pe6 ad5/pe5 ad4/pe4 ad3/pe3 ad2/pe2 ad1/pe1 ad0/pe0 vrl nc nc vrh vssad nc a7/pf7 a6/pf6 a5/pf5 a4/pf4 a3/pf3 a2/pf2 a1/pf1 a0/pf0 nc nc nc pd2/miso pd1/txd pd0rxd moda/lir reset xfc vddsyn nc nc nc extal xtal e 4xout vddr vssr pc7/d7 pc6/d6 pc5/d5 pc4/d4 pc3/d3 pc2/d2 pc1/d1 pc0/d0 irq nc nc nc nc pb0/a8 pb1/a9 pb2/a10 pb3/a11 pb4/a12/lcd4 pb5/a13/lcd5 pb6/a14/lcd6 pb7/a15/lcd7 vss vdd pa0/ic3 pa3/oc1/oc5/ic4 pa4/oc1/oc4 pa5/oc1/oc3 pa6/oc1/oc2 pa7/oc1/pai pd5/ss pd4/sck pd3/mosi nc nc nc nc nc pa1/ic2 pa2/ic1 tpg 240
MC68HC11PH8 motorola b-3 mechanical data and ordering information 13 b.2 package dimensions figure b-3 84-pin plcc mechanical dimensions ele eme epe ene pin 1 pin 84 v w y brk z r a c j e g g1 u b g1 z1 x 0.10 ete seating plane case no. 780-01 84 lead plcc dim. min. max. notes dim. min. max. a 30.10 30.35 1. due to space limitations, this case shall be represented by a general case outline, rather than one showing all the leads. 2. datums ele, eme, ene and epe are determined where top of lead shoulder exits plastic body at mould parting line. 3. dimension g1, true position to be measured at datum ete (seating plane). 4. dimensions r and u do not include mould protrusion. allowable mould protrusion is 0.25mm per side. 5. dimensions and tolerancing per ansi y 14.5m, 1982. 6. all dimensions in mm. u 29.21 29.36 b 30.10 30.35 v 1.07 1.21 c 4.20 4.57 w 1.07 1.21 e 2.29 2.79 x 1.07 1.42 f 0.33 0.48 y ? 0.50 g 1.27 bsc z 2 10 h 0.66 0.81 g1 28.20 28.70 j 0.51 ? k1 1.02 ? k 0.64 ? z1 2 10 r 29.21 29.36 (note 1) h k1 k f 0.18 t n ep l em ms ss s 0.18 t l em n ep ms ss s 0.18 t l em n ep ms ss s 0.18 t n ep l em ms ss s 0.25 t l em n ep ss ss s 0.18 t n ep l em ms ss s 0.18 t l em n ep ms ss s 0.18 t n ep l em ms ss s 0.18 t l em n ep ms ss s tpg 241
motorola b-4 MC68HC11PH8 mechanical data and ordering information 13 figure b-4 84-pin cerquad mechanical dimensions ele eme epe ene pin 1 pin 84 v w y brk z r a c j e g g1 u b g1 z1 x 0.10 ete seating plane case no. 780a-01 84 lead cerquad dim. min. max. notes dim. min. max. a 30.10 30.35 1. due to space limitations, this case shall be represented by a general case outline, rather than one showing all the leads. 2. datums ele, eme, ene and epe are determined where top of lead shoulder exits package body at glass parting line. 3. dimension g1, true position to be measured at datum ete (seating plane). 4. dimensions r and u do not include glass protrusion. allowable glass protrusion is 0.25mm per side. 5. dimensions and tolerancing per ansi y 14.5m, 1982. 6. all dimensions in mm. u 29.21 29.36 b 30.10 30.35 v 1.07 1.21 c 4.20 4.57 w 1.07 1.21 e 2.29 2.79 x 1.07 1.42 f 0.33 0.53 y ? 0.50 g 1.27 bsc z 2 10 h 0.66 0.81 g1 28.20 28.70 j 0.51 ? k1 1.02 ? k 0.64 ? z1 2 10 r 29.21 29.36 (note 1) h k1 k f 0.18 t n ep l em ms ss s 0.18 t l em n ep ms ss s 0.18 t l em n ep ms ss s 0.18 t n ep l em ms ss s 0.25 t l em n ep ss ss s 0.18 t n ep l em ms ss s 0.18 t l em n ep ms ss s 0.18 t n ep l em ms ss s 0.18 t l em n ep ms ss s tpg 242
MC68HC11PH8 motorola b-5 mechanical data and ordering information 13 figure b-5 112-pin tqfp mechanical dimensions please contact your motorola sales of?e for up-to-date information on the mechanical dimensions for this package type. tpg 243
motorola b-6 MC68HC11PH8 mechanical data and ordering information 13 b.3 ordering information use the information in table b-1 to specify the appropriate device type when placing an order. table b-1 ordering information package temperature description frequency mc order number 84-pin plcc e40 to +85 c custom rom 3mhz 4mhz MC68HC11PH8cfn3 MC68HC11PH8cfn4 custom rom, with security feature 3mhz 4mhz mc68s11ph8cfn3 mc68s11ph8cfn4 otprom (with security feature) 3mhz 4mhz mc68s711ph8cfn3 mc68s711ph8cfn4 112-pin tqfp e40 to +85 c custom rom 3mhz 4mhz MC68HC11PH8cpv3 MC68HC11PH8cpv4 custom rom, with security feature 3mhz 4mhz mc68s11ph8cpv3 mc68s11ph8cpv4 otprom (with security feature) 3mhz 4mhz mc68s711ph8cpv3 mc68s711ph8cpv4 84-pin cerquad e40 to +85 c eprom (with security feature) 3mhz 4mhz mc68s711ph8cfs3 mc68s711ph8cfs4 tpg 244
MC68HC11PH8 motorola c-1 development support 14 c development support the following information provides a reference to development tools for the m68hc11 family of microcontrollers. for more detailed information please refer to the appropriate system manual. note: target cables for the evaluation module should be ordered separately. c.1 evs ?evaluation system the evs is an economical tool for designing, debugging and evaluating target systems based on the MC68HC11PH8 and mc68hc711ph8 device types. the two printed circuit boards that comprise the evs are the m68em11ph8 emulator module and the m68pfb11kit platform board. the main features of the evs are as follows: monitor/debugger ?mware single-line assembler/disassembler host computer download capability dual memory maps: 64kbyte monitor map that includes 16kbytes of monitor eprom mc68hc711ph8 user map that includes 64kbytes of emulation ram mcu extension i/o port for single chip, expanded and special test operating modes rs-232c terminal and host i/o ports logic analyser connector table c-1 m68hc11 development tools devices evaluation boards evaluation modules evaluation systems/kits programmer boards MC68HC11PH8, mc68hc711ph8 ? m68em11ph8 ? m68spgmr11 tpg 245
MC68HC11PH8 motorola c-2 development support 14 c.2 mmds11 ?motorola modular development system the mmds11 is an emulator system that provides a bus state analyser and real-time memory windows. the units integrated design environment includes an editor, an assembler, user interface and source-level debug. a complete mmds11 consists of: a station module ?the metal mmds11 enclosure, containing the control board and the internal power supply. most system cables connect to the mmds11 station module. (the cable to an optional target system, however, runs through an aperture in the station module enclosure to connect directly to the emulator module). an emulator module (em) ?such as the em11ph8: a printed circuit board that enables system functionality for a speci? set of mcus. the em ?s into the station module through a sliding panel in the enclosure top. the em has a connector for the target cable. two logic clip cable assemblies ?twisted pair cables that connect the station module to your target system, a test ?ture, a clock or any other circuitry useful for evaluation or analysis. one end of each cable assembly has a moulded connector, which ?s into station module pod a or pod b. leads at the other end of the cable terminate in female probe tips. ball clips come with the cables. a 9-lead rs-232 serial cable ?the cable that connects the station module to the host computers rs-232 port. c.3 spgmr11 ?serial programmer system the spgmr11 is an economical tool for programming m68hc11 mcus. the system consists of the m68spgmr11 unit and a programming module which adapts the spgmr11 to the appropriate mcu and package type. the programming module can be ordered as m68pa11ph8fn84 (for the 84-pin package) and m68pa11ph8pv112 (for the 112-pin package). tpg 246
MC68HC11PH8 motorola i glossary glossary this section contains abbreviations and specialist words used in this data sheet and throughout the industry. further information on many of the terms may be gleaned from motorolas m68hc11 reference manual, m68hc11rm/ad , or from a variety of standard electronics text books. $xxxx the digits following the ? are in hexadecimal format. %xxxx the digits following the ? are in binary format. a/d , adc analog-to-digital (converter). bootstrap mode in this mode the device automatically loads its internal memory from an external source on reset and then allows this program to be executed. byte eight bits. ccr condition codes register; an integral part of the cpu. cerquad a ceramic package type, principally used for eprom and high temperature devices. clear ? ?the logic zero state; the opposite of ?et? cmos complementary metal oxide semiconductor. a semiconductor technology chosen for its low power consumption and good noise immunity. cop computer operating properly. aka ?atchdog? this circuit is used to detect device runaway and provide a means for restoring correct operation. cpu central processing unit. d/a, dac digital-to-analog (converter). eeprom electrically erasable programmable read only memory. aka ?erom? eprom erasable programmable read only memory. this type of memory requires exposure to ultra-violet wavelengths in order to erase previous data. aka ?rom? esd electrostatic discharge. expanded mode in this mode the internal address and data bus lines are connected to external pins. this enables the device to be used in much more complex systems, where there is a need for external memory for example. evs evaluation system. one of the range of platforms provided by motorola for evaluation and emulation of their devices. tpg 247
motorola ii MC68HC11PH8 glossary hcmos high-density complementary metal oxide semiconductor. a semiconductor technology chosen for its low power consumption and good noise immunity. i/o input/output; used to describe a bidirectional pin or function. input capture (ic) this is a function provided by the timing system, whereby an external event is ?aptured by storing the value of a counter at the instant the event is detected. interrupt this refers to an asynchronous external event and the handling of it by the mcu. the external event is detected by the mcu and causes a predetermined action to occur. irq interrupt request. the overline indicates that this is an active-low signal format. k byte a kilo-byte (of memory); 1024 bytes. lcd liquid crystal display. lsb least signi?ant byte. m68hc11 motorolas family of advanced 8-bit mcus. mcu microcontroller unit. mi bus motorola interconnect bus. a single wire, medium speed serial communications protocol. msb most signi?ant byte. nibble half a byte; four bits. nrz non-return to zero. opcode the opcode is a byte which identi?s the particular instruction and operating mode to the cpu. see also: prebyte, operand. operand the operand is a byte containing information the cpu needs to execute a particular instruction. there may be from 0 to 3 operands associated with an opcode. see also: opcode, prebyte. output compare (oc) this is a function provided by the timing system, whereby an external event is generated when an internal counter value matches a prede?ed value. plcc plastic leaded chip carrier package. pll phase-locked loop circuit. this provides a method of frequency multiplication, to enable the use of a low frequency crystal in a high frequency circuit. prebyte this byte is sometimes required to qualify an opcode, in order to fully specify a particular instruction. see also: opcode, operand. pull-down, pull-up these terms refer to resistors, sometimes internal to the device, which are permanently connected to either ground or v dd . pwm pulse width modulation. this term is used to describe a technique where the width of the high and low periods of a waveform is varied, usually to enable a representation of an analog value. qfp quad ?t pack package. tpg 248
MC68HC11PH8 motorola iii glossary ram random access memory. fast read and write, but contents are lost when the power is removed. rfi radio frequency interference. rti real-time interrupt. rom read-only memory. this type of memory is programmed during device manufacture and cannot subsequently be altered. rs-232c a standard serial communications protocol. sar successive approximation register. sci serial communications interface. set ? ?the logic one state; the opposite of ?lear? silicon glen an area in the central belt of scotland, so called because of the concentration of semiconductor manufacturers and users found there. single chip mode in this mode the device functions as a self contained unit, requiring only i/o devices to complete a system. spi serial peripheral interface. test mode this mode is intended for factory testing. ttl transistor-transistor logic. uart universal asynchronous receiver transmitter. vco voltage controlled oscillator. watchdog see ?op? wired-or a means of connecting outputs together such that the resulting composite output state is the logical or of the state of the individual outputs. word two bytes; 16 bits. xirq non-maskable interrupt request. the overline indicates that this has an active-low signal format. tpg 249
motorola iv MC68HC11PH8 glossary this page intentionally left blank tpg 250
MC68HC11PH8 motorola v index index in this index numeric entries are placed ?st; page references in italics indicate that the reference is to a ?ure. 16-bit pwm 8-28 4xclk 2-9 , 2-10 4xout pin 2-6 8-bit modulus timers 8-35 block diagram 8-36 clock select 8-37 interrupt source resolution 10-25 reset 10-9 t8acr ?8-bit modulus timer a control reg. 8-38 t8adr ?8-bit modulus timer a data reg. 8-38 t8bcr ?8-bit modulus timer b control reg. 8-39 t8bdr ?8-bit modulus timer b data reg. 8-39 t8ccr ?8-bit modulus timer c control reg. 8-40 t8cdr ?8-bit modulus timer c data reg. 8-40 a a/d 9-1 accuracy of conversion 4-6 adctl ?a/d control and status reg. 9-8 adr1?dr4 ?a/d converter results reg. 9-10 block diagram 9-2 channels 9-7 , 9-9 charge pump 9-3 clocks 9-4 conversion 9-3 , 9-4 , 9-4 , 9-5 , 9-8 input pin 9-3 multiple-channel operation 9-8 , 9-9 multiplexer 9-2 , 9-7 option ?system configuration options reg. 1 9-5 overview 9-1 pins 9-1 reset 10-10 single-channel operation 9-7 stop mode 9-10 synchronisation 9-4 wait mode 9-10 accumulators 11-2 adctl ?a/d control and status reg. 9-8 addressing modes 11-7 address-mark wakeup 5-4 adpu - bit in option 9-5 adr1?dr4 ?a/d converter results reg. 9-10 analog-to-digital converter - see a/d auto - bit in pllcr 2-9 b baud rates bootloader 3-2 sci 5-6 bcs - bit in pllcr 2-9 biphase coding 6-1 , 6-3 block diagrams 8-bit modulus timers 8-36 a/d 9-2 mc68hc(7)11ph8 1-3 mi bus 6-5 pll 2-6 pulse accumulator 8-24 pwm 8-29 sci 5-3 sci baud rate 5-1 spi 7-2 timer 8-7 timer clock divider chains 8-5 , 8-6 bootloader 3-2 , 3-4 , 3-5 boundary conditions, pwm 8-34 bppue - bit in ppar 4-11 bprot ?block protect reg. 3-21 bprt[5:0] - bits in bprot 3-21 brst - bit in scbdh 5-6 bspl - bit in scbdh 5-6 btst - bit in scbdh 5-6 bulkp - bit in bprot 3-21 bwc - bit in pllcr 2-10 bypassing 2-2 , 2-7 byte - bit in pprog 3-26 c c-bit in ccr 11-5 ccf - bit in adctl 9-8 ccr ?condition code reg. 11-4 tpg 251
motorola vi MC68HC11PH8 index cd?a - bits in adctl 9-9 cforc ?timer compare force reg. 8-12 charge pump, a/d 9-3 clk4x - bit in config 3-13 clock monitor 10-4 , 10-5 clock rate, mi bus 6-7 , 6-9 clocks 4xclk 2-9 , 2-10 a/d 9-4 cmos compatible 2-3 e 2-3 , 3-19 monitor reset 10-4 , 10-5 pwm 8-30 spi 7-4 st4xck 6-7 stretching 3-19 timer divider chains 8-5 , 8-6 cme - bit in option 10-5 coherency, timer 8-12 con12 - bit in pwclk 8-28 con34 - bit in pwclk 8-28 concatenation, of pwm 8-28 config ?system configuration reg. 3-12 programming 3-29 configuration 3-12 conversion, a/d 9-3 , 9-4 , 9-4 , 9-5 cop 8-2 , 8-23 config ?configuration control reg. 10-6 coprst ?arm/reset cop timer circuitry reg. 10-3 enable 10-7 option ?system configuration options reg. 1 10-4 rates 10-3 , 10-5 reset 10-2 , 10-3 , 10-9 timeout 10-2 coprst ?arm/reset cop timer circuitry reg. 10-3 corruption of a/d 4-6 of memory 2-3 cpha - bit in spcr 7-3 , 7-4 , 7-7 cpol - bit in spcr 7-6 cpu 11-1 accumulators (a, b and d) 11-2 architecture 11-1 ccr ?condition code reg. 11-4 index registers (ix, iy) 11-2 program counter (pc) 11-4 programming model 11-1 registers 11-1 reset 10-8 cr[1:0] - bits in option 10-5 csa[2:0] - bits in t8acr 8-38 csb[2:0] - bits in t8bcr 8-39 csc[2:0] - bits in t8ccr 8-40 csel - bit in option 9-6 cwom - bit in opt2 4-12 d dac 9-3 data format, sci 5-2 data types 11-6 dda[7:0] - bits in ddra 4-2 ddb[7:0] - bits in ddrb 4-3 ddc[7:0] - bits in ddrc 4-4 ddd[5:0] - bits in ddrd 4-5 ddf[7:0] - bits in ddrf 4-7 ddg[7:0] - bits in ddrg 4-8 ddh[7:0] - bits in ddrh 4-9 ddra ?data direction reg. for port a 4-2 ddrb ?data direction reg. for port b 4-3 ddrc ?data direction reg. for port c 4-4 ddrd ?data direction reg. for port d 4-5 ddrf ?data direction reg. for port f 4-7 ddrg ?data direction reg. for port g 4-8 ddrh ?data direction reg. for port h 4-9 development tools c-1 dir - direct addressing mode 11-7 discp - bit in pwen 8-32 dise - bit in opt2 3-20 dly - bit in option 3-17 mask option 3-17 duty cycle, pwm 8-34 dwom - bit in spcr 7-6 e e clock pin 2-5 edgxa and edgxb - bits in tctl2 8-9 eelat - bit in pprog 3-26 eeon - bit in config 3-14 eepgm - bit in pprog 3-26 eeprom 3-25 3-28 erased state ($ff) 3-25 erasing 3-27 3-28 pprog ?eeprom programming control reg. 3-25 security 3-30 eex - bits in init2 3-16 eight bit modulus timers - see 8-bit modulus timers elat - bit in eprog 3-23 epgm - bit in eprog 3-24 eprog ?eprom programming control reg. 3-23 eprom 3-5 , 3-23 3-25 device 1-1 eprog ?eprom programming control reg. 3-23 erased state ($ff) 3-23 programming 3-24 erase - bit in pprog 3-26 erased state eeprom ($ff) 3-25 eprom ($ff) 3-23 error detection, sci 5-5 esd protection a-1 even - bit in pprog 3-25 event counter - see pulse accumulator tpg 252
MC68HC11PH8 motorola vii index evs ?evaluation system c-1 excol - bit in eprog 3-24 exrow - bit in eprog 3-24 ext4x - bit in opt2 3-20 extal pin 2-3 f fcme - bit in option 10-5 fe - bit in scsr1 5-11 fe2 - bit in s2sr1 5-16 foc[1:5] - bits in cforc 8-13 fppue - bit in ppar 4-11 free-running counter 8-1 freez - bit in config 3-13 g gppue - bit in ppar 4-11 gwom - bit in sp2cr 2-17 h h-bit in ccr 11-6 hppue - bit in ppar 4-11 hprio ?highest priority i-bit interrupt & misc. reg. 3-11 i i/o, on reset 10-8 i4/05 - bit in pactl 8-10 , 8-25 i4/o5f - bit in tflg1 8-16 i4/o5i - bit in tmsk1 8-15 i-bit in ccr 10-16 , 11-5 ic1f?c3f - bits in tflg1 8-16 ic1i?c3i - bits in tmsk1 8-15 idle - bit in scsr1 5-10 idle2 - bit in s2sr1 5-16 idle-line wakeup 5-4 ieh[7:0] - bits in woieh 4-10 ilie - bit in sccr2 5-9 ilie2 - bit in s2cr2 5-16 illegal opcode trap 10-16 ilt - bit in sccr1 5-8 ilt2 - bit in s2cr1 5-16 imm - immediate addressing mode 11-7 ind, x/y - indexed addressing modes 11-8 index registers (ix, iy) 11-2 inh - inherent addressing mode 11-8 init ?ram and i/o mapping reg. 3-14 init2 ?eeprom mapping and mi bus delay reg. 6-8 initialization 3-12 input capture 8-8 instruction set 11-8 internal oscillator 3-17 , 9-4 , 9-5 , a-16 interrupts 8-bit modulus timers 10-25 i-bit 10-16 , 11-5 illegal opcode trap 10-16 irq 2-12 maskable 10-17 multiple sources 2-12 non-maskable 10-16 priorities 10-11 priority resolution 10-21 sci 5-14 , 10-24 sensitivity 2-12 stacking 10-15 swi 10-16 triggering 2-12 types 10-15 wired-or 2-12 x-bit 10-16 , 11-6 xirq 2-12 , 10-16 irq pin 2-12 irqe - bit in option 3-17 irvne - bit in opt2 3-19 j junction temperature, chip a-2 l lcd driver interface 7-1 lcd module 2-18 clock source 8-23 lcdbp - lcd backplane 2-18 lcdr ?lcd control and data reg. 2-18 reset 10-10 lcd[7:4] - bits in lcdr 2-18 lcdbp - lcd backplane 2-18 lcdck - bit in lcdr 2-19 lcde - bit in lcdr 2-19 lcdr ?lcd control and data reg. 2-18 lir pin 2-13 lirdv - bit in opt2 3-18 loops - bit in sccr1 5-7 lops2 - bit in s2cr1 5-16 low power modes ram 3-5 stand-by connections 2-13 stand-by voltage 2-13 stop 10-18 wait 10-17 low voltage inhibit circuit 2-3 lsbf - bit in opt2 7-9 lvi 2-3 tpg 253
motorola viii MC68HC11PH8 index m m - bit in sccr1 5-8 m2 - bit in s2cr1 5-16 m2dl1:m2dl0 - bits in init2 6-8 manchester coding 6-1 , 6-2 , 6-3 mask options 1-2 oscillator buffer type 2-4 pll crystal frequency 2-7 romon bit 3-14 security 3-30 stabilization delay timing 3-17 maximum ratings a-1 mbe - bit in eprog 3-23 mc68hc711ph8 1-1 mcs - bit in pllcr 2-10 mda - bit in hprio 3-11 memory corruption of 2-3 eeprom 3-25 3-28 eprom 3-5 , 3-23 3-25 map 3-3 mapping 3-4 , 3-14 3-16 protection 3-21 , 3-30 ram 3-4 ram stand-by connections 2-13 register map 3-5 rom 3-5 stretch external access 3-19 memory map, on reset 10-8 mi bus 1-2 , 6-1 block diagram 6-5 clock rate 6-7 , 6-9 error detection 6-4 init2 ?eeprom mapping and mi bus delay reg. 6-8 interface 6-6 manchester coding 6-1 , 6-3 pins 6-1 pull field 6-3 push field 6-2 s2bdh, s2bdl ?mi bus clock rate control reg. 6-9 s2cr1 ?mi bus control reg. 1 6-9 s2cr2 ?mi bus2 control reg. 2 6-10 s2drl ?mi bus2 data reg. 6-12 s2sr1 ?mi bus status reg. 1 6-11 s2sr2 ?mi bus2 status reg. 2 6-12 st4xck clock 6-7 timing 6-2 mie2 - bit in s2cr1 5-16 , 6-9 miso 7-4 moda/lir pin 2-13 modb/vstby pin 2-13 modf - bit in spsr 7-8 modulus timers - see 8-bit modulus timers mosi 7-4 mstr - bit in spcr 7-5 , 7-6 mult - bit in adctl 9-9 multiplexer, a/d 9-2 , 9-7 multiplication factor, pll 2-11 n n-bit in ccr 11-5 nf - bit in scsr1 5-11 nf2 - bit in s2sr1 5-16 , 6-12 nmi 2-12 , 10-16 nocop - bit in config 10-7 noise 2-2 , 2-4 , 2-5 , 2-7 non-maskable interrupt 2-12 nosec - bit in config 3-31 o oc1d ?output compare 1 data reg. 8-13 oc1d[7:3] - bits in oc1d 8-13 oc1f?c4f - bits in tflg1 8-16 oc1i?c4i - bits in tmsk1 8-15 oc1m ?output compare 1 mask reg. 8-13 oc1m[7:3] - bits in oc1m 8-13 odd - bit in pprog 3-25 ol[2:5] - bits in tctl1 8-14 om[2:5] - bits in tctl1 8-14 operating modes 3-1 baud rates 3-2 bootstrap 3-2 expanded 3-1 hprio register 3-11 selection of 2-13 , 3-10 single chip 3-1 stop 3-5 , 10-18 test 3-2 vstby 3-5 wait 10-17 opt2 ?system configuration options reg. 2 3-18 option ?system configuration options reg. 1 9-5 , 10-4 or - bit in scsr1 5-11 or2 - bit in s2sr1 5-16 , 6-11 ordering information b-6 oscillator 2-3 connections 2-4 output compare 8-11 overflow bit in ccr 11-5 p packages cerquad b-4 options 2-1 plcc b-3 thermal characteristics a-1 tqfp b-5 pacnt ?pulse accumulator count reg. 8-26 pactl ?pulse accumulator control reg. 8-25 paen - bit in pactl 8-25 paif - bit in tflg2 8-27 paii - bit in tmsk2 8-27 pamod - bit in pactl 8-25 tpg 254
MC68HC11PH8 motorola ix index paovf - bit in tflg2 8-26 paovi - bit in tmsk2 8-26 paren - bit in config 4-13 pcka[2:1] - bits in pwclk 8-30 pckb[3:1] - bits in pwclk 8-30 pclk[2:1] - bits in pwpol 8-31 pclk[4:3] - bits in pwpol 8-31 pe - bit in sccr1 5-8 pe2 - bit in s2cr1 5-16 pedge - bit in pactl 8-25 pf - bit in scsr1 5-11 pf2 - bit in s2sr1 5-16 phase-locked loop - see pll pinouts cerquad 2-1 plcc 2-1 tqfp 2-2 pins 4xout 2-6 e clock 2-5 extal 2-3 irq 2-12 lir 2-13 moda/lir 2-13 modb/vstby 2-13 oc1, special features 8-4 , 8-11 r/w 2-13 reset 2-3 , 10-2 vdd ad, vss ad 2-2 vdd, vss 2-2 vddl, vddr, vssl, vssr 2-2 vddsyn 2-6 vppe 2-12 vrh, vrl 2-13 vstby 2-13 xfc 2-6 xirq /vppe 2-12 xtal 2-3 pll 2-6 bandwidth 2-7 block diagram 2-6 changing frequency 2-8 crystal frequency mask option 2-7 multiplication factor 2-11 pllcr ?pll control reg. 2-9 synchronisation 2-8 synr ?synthesizer program reg. 2-11 vcoout 2-9 pllcr ?pll control reg. 2-9 pllcr ?pll control register 2-9 pllon - bit in pllcr 2-9 por 10-1 stabilization delay 10-1 porta ?port a data reg. 4-2 portb ?port b data reg. 4-3 portc ?port c data reg. 4-4 portd ?port d data reg. 4-5 porte ?port e data reg. 4-6 portf ?port f data reg. 4-7 portg ?port g data reg. 4-8 porth ?port h data reg. 4-9 ports a (timer) 2-14 , 4-2 b (a[15:8], lcd) 2-14 , 4-3 c (d[7:0]) 2-16 , 4-4 d (sci1, spi1) 2-16 , 4-5 ddra ?data direction reg. for port a 4-2 ddrb ?data direction reg. for port b 4-3 ddrc ?data direction reg. for port c 4-4 ddrd ?data direction reg. for port d 4-5 ddrf ?data direction reg. for port f 4-7 ddrg ?data direction reg. for port g 4-8 ddrh ?data direction reg. for port h 4-9 e (a/d) 2-17 , 4-6 f (a[7:0]) 2-17 , 4-7 g (r/w , sci2, spi2, lcd) 2-17 , 4-8 h (pwm, modulus timers) 2-18 , 4-9 porta ?port a data reg. 4-2 portb ?port b data reg. 4-3 portc ?port c data reg. 4-4 portd ?port d data reg. 4-5 porte ?port e data reg. 4-6 portf ?port f data reg. 4-7 portg ?port g data reg. 4-8 porth ?port h data reg. 4-9 signals 2-14 power-on reset - see por ppar ?port pull-up assignment reg. 4-11 ppol[4:1] - bits in pwpol 8-31 pprog ?eeprom programming control reg. 3-25 pr[1:0] - bits in tmsk2 3-22 , 8-17 prb - bit in t8bcr 8-39 prc - bit in t8ccr 8-40 prebyte 11-7 prescaler, pwm 8-30 priorities, resets and interrupts 10-11 , 10-12 program counter (pc) 11-4 programming config 3-29 eeprom 3-25 eprom 3-24 protection of memory 3-21 , 3-30 registers 3-10 psel[4:0] - bits in hprio 10-12 pt - bit in sccr1 5-8 pt2 - bit in s2cr1 6-10 ptcon - bit in bprot 3-21 pull field 6-3 pull-ups 4-11 pulse accumulator 8-1 , 8-23 block diagram 8-24 pacnt ?pulse accumulator count reg. 8-26 pactl ?pulse accumulator control reg. 8-25 reset 10-9 tflg2 ?timer interrupt flag 2 reg. 8-26 tmsk2 ?timer interrupt mask 2 reg. 8-26 pulse-width modulation - see pwm push field 6-2 pwclk ?pwm clock prescaler and 16-bit select reg. 8-28 tpg 255
motorola x MC68HC11PH8 index pwcnt1? ?pwm timer counter reg. 1 to 4 8-33 pwdty1? ?pwm timer duty cycle reg. 1 to 4 8-34 pwen ?pwm timer enable reg. 8-32 pwen[4:1] - bits in pwen 8-32 pwm 8-27 16-bit operation 8-28 block diagram 8-29 boundary conditions 8-34 clock select 8-30 duty cycle 8-27 , 8-34 periods 8-27 pins 8-27 pwclk ?pwm clock prescaler and 16-bit select reg. 8-28 pwcnt1? ?pwm timer counter reg. 1 to 4 8-33 pwdty1? ?pwm timer duty cycle reg. 1 to 4 8-34 pwen ?pwm timer enable reg. 8-32 pwper1? ?pwm timer period reg. 1 to 4 8-33 pwpol ?pwm timer polarity & clock source select reg. 8-31 pwscal ?pwm timer prescaler reg. 8-31 pwper1? ?pwm timer period reg. 1 to 4 8-33 pwpol ?pwm timer polarity & clock source select reg. 8-31 pwscal ?pwm timer prescaler reg. 8-31 r r/t[7:0] - bits in s2drl 5-17 , 6-12 r/t[7:0] - bits in scdrl 5-12 r/w pin 2-13 r8 - bit in scdrh 5-12 r8b - bit in s2drh 5-17 raf - bit in scsr2 5-12 raf2 - bit in s2sr2 5-17 , 6-12 ram 3-4 data retention 3-5 security 3-30 ram[3:0] - bit in init 3-14 ratiometric conversions 9-5 rboot - bit in hprio 3-11 rdrf - bit in scsr1 5-10 rdrf2 - bit in s2sr1 5-16 , 6-11 re - bit in sccr2 5-9 re2 - bit in s2cr2 5-16 , 6-10 real-time interrupt - see rti receiver flags, sci 5-13 reg[3:0] - bit in init 3-15 rel - relative addressing mode 11-8 reset pin 2-3 resets circuit 2-3 clock monitor 10-4 , 10-5 cop 10-2 , 10-3 effect on 8-bit modulus timers 10-9 effect on a/d 10-10 effect on cop 10-9 effect on cpu 10-8 effect on i/o 10-8 resets (continued) effect on lcd module 10-10 effect on memory map 10-8 effect on pulse accumulator 10-9 effect on rti 10-9 effect on sci 10-9 effect on spi 10-10 effect on system 10-10 effect on timer 10-8 effects of 10-7 external 10-2 hprio ?highest priority i-bit interrupt and misc. reg. 10-12 power-on, por 10-1 priorities 10-11 processing flow 10-19 reset pin 10-2 resetting the cop watchdog 10-3 rfi 2-4 , 2-5 rie - bit in sccr2 5-9 rie2 - bit in s2cr2 5-16 , 6-10 rom 3-5 romad - bit in config 3-12 romon - bit in config 3-14 mask option 3-14 row - bit in pprog 3-26 rti 8-2 , 8-19 pactl ?pulse accumulator control reg. 8-22 rates 8-19 reset 10-9 tflg2 ?timer interrupt flag reg. 2 8-21 tmsk2 ?timer interrupt mask reg. 2 8-20 rtif - bit in tflg2 8-21 rtii - bit in tmsk2 8-20 rtr[1:0] - bits in pactl 8-22 rwu - bit in sccr2 5-4 , 5-9 rwu2 - bit in s2cr2 5-16 s s2b[12:0] - bits in s2bdh/l 6-9 s2bdh, s2bdl ?mi bus clock rate control reg. 6-9 s2bdh, s2bdl ?sci2 baud rate control reg. 5-15 s2cr1 ?mi bus control reg. 1 6-9 s2cr1 ?sci2 control reg. 1 5-16 s2cr2 ?mi bus2 control reg. 2 6-10 s2cr2 ?sci2 control reg. 2 5-16 s2drh, s2drl ?sci2 data high/low reg. 5-17 s2drl ?mi bus2 data reg. 6-12 s2sr1 ?mi bus status reg. 1 6-11 s2sr1 ?sci2 status reg. 1 5-16 s2sr2 ?mi bus2 status reg. 2 6-12 s2sr2 ?sci2 status reg. 2 5-17 s-bit in ccr 11-6 sbk - bit in sccr2 5-9 sbk2 - bit in s2cr2 5-16 , 6-10 sbr[12:0] - bits in scbdh/l 5-6 scan - bit in adctl 9-8 scbdh, scbdl ?sci baud rate control reg. 5-6 tpg 256
MC68HC11PH8 motorola xi index sccr1 ?sci control reg. 1 5-7 sccr2 ?sci control reg. 2 5-9 scdrh, scdrl ?sci data high/low reg. 5-12 sci 5-1 baud rate 5-1 , 5-6 block diagram 5-3 data format 5-2 error detection 5-5 interrupt source resolution 5-14 , 10-24 pins 5-1 receive operation 5-2 reset 10-9 scbdh, scbdl ?sci baud rate control reg. 5-6 sccr1 ?sci control reg. 1 5-7 sccr2 ?sci control reg. 2 5-9 scdrh, scdrl ?sci data high/low reg. 5-12 scsr1 ?sci status reg. 1 5-10 scsr2 ?sci status reg. 2 5-12 status flags 5-13 transmit operation 5-2 wakeup 5-4 sci2 - see also sci 5-15 sck 7-4 scsr1 ?sci status reg. 1 5-10 scsr2 ?sci status reg. 2 5-12 security 3-30 mask option 3-30 nosec bit 3-31 sensitivity, of interrupts 2-12 , 3-17 serial communications interface - see sci serial peripheral interface - see spi slave select (ss ) 7-4 slow memory 3-19 smod - bit in hprio 3-11 software interrupt (swi) 10-16 sp2cr ?spi2 control reg. 7-11 sp2dr ?spi2 data reg. 7-11 sp2opt ?spi2 control options reg. 7-11 sp2sr ?spi2 status reg. 7-11 spcr ?serial peripheral control reg. 7-6 spdr ?spi data reg. 7-8 spe - bit in spcr 7-6 spi 7-1 block diagram 7-2 buffering 7-1 , 7-8 clock phase 7-3 clock polarity 7-6 clock rate 7-4 , 7-7 errors 7-5 master mode 7-6 miso 7-4 mosi 7-4 opt2 ?system configuration options reg. 2 7-9 pins 7-1 polarity 7-3 reset 10-10 sck 7-4 signals 7-3 spcr ?serial peripheral control reg. 7-6 spdr ?spi data reg. 7-8 spi (continued) spsr ?serial peripheral status reg. 7-7 ss 7-4 transfer formats 7-2 , 7-3 spi2 - see also spi 7-10 spie - bit in spcr 7-5 , 7-6 spif - bit in spsr 7-7 spr1 and spr0 - bits in spcr 7-7 spr2 - bit in opt2 7-9 spsr ?serial peripheral status reg. 7-7 st4xck clock 6-7 stack pointer (sp) 11-2 stacking operations 11-3 stand-by voltage 2-13 status flags, sci 5-13 stop mode 3-5 , 10-18 disabling 11-6 stabilization delay 3-17 strch - bit in opt2 3-19 stretch, external access 3-19 strx - bit in init2 3-16 swi 10-16 synchronisation, a/d 9-4 synr ?synthesizer program reg. 2-11 synx[1:0] - bits in synr 2-11 syny[5:0] - bits in synr 2-11 system reset 10-10 t t16en - bit in pllcr 8-4 t8 - bit in scdrh 5-12 t8acr ?8-bit modulus timer a control reg. 8-38 t8adr ?8-bit modulus timer a data reg. 8-38 t8af - bit in t8acr 8-38 t8ai - bit in t8acr 8-38 t8b - bit in s2drl 5-17 t8bcr ?8-bit modulus timer b control reg. 8-39 t8bdr ?8-bit modulus timer b data reg. 8-39 t8bf - bit in t8bcr 8-39 t8bi - bit in t8bcr 8-39 t8ccr ?8-bit modulus timer c control reg. 8-40 t8cdr ?8-bit modulus timer c data reg. 8-40 t8cf - bit in t8ccr 8-40 t8ci8 - bit in t8ccr 8-40 tc - bit in scsr1 5-10 tc2 - bit in s2sr1 5-16 tcie - bit in sccr2 5-9 tcie2 - bit in s2cr2 5-16 tcnt ?timer counter reg. 8-14 tctl1 ?timer control reg. 1 8-14 tctl2 ?timer control reg. 2 8-9 tdre - bit in scsr1 5-10 tdre2 - bit in s2sr1 5-16 te - bit in sccr2 5-9 te2 - bit in s2cr2 5-16 , 6-10 test methods a-3 tflg1 ?timer interrupt flag reg. 1 8-16 tflg2 ?timer interrupt flag reg. 2 8-18 tpg 257
motorola xii MC68HC11PH8 index ti4/o5 ?timer input capture 4/output compare 5 reg. 8-10 tic1?ic3 ?timer input capture reg. 8-10 tie - bit in sccr2 5-9 tie2 - bit in s2cr2 5-16 time accumulation - see pulse accumulator timer 8-1 block diagram 8-7 cforc ?timer compare force reg. 8-12 clock divider chains 8-5 , 8-6 coherency 8-12 cop 8-23 free-running counter 8-1 input capture 8-8 oc1, special features 8-4 , 8-11 oc1d ?output compare 1 data reg. 8-13 oc1m ?output compare 1 mask reg. 8-13 output compare 8-11 pins 8-4 prescaler 8-1 reset 10-8 tcnt ?timer counter reg. 8-14 tctl1 ?timer control reg. 1 8-14 tctl2 ?timer control reg. 2 8-9 tflg1 ?timer interrupt flag reg. 1 8-16 tflg2 ?timer interrupt flag reg. 2 8-18 ti4/o5 ?timer input capture 4/output compare 5 reg. 8-10 tic1?ic3 ?timer input capture reg. 8-10 tmsk1 ?timer interrupt mask reg. 1 8-15 tmsk2 ?timer interrupt mask reg. 2 3-22 , 8-17 toc1?oc4 ?timer output compare reg. 8-12 tmsk1 ?timer interrupt mask reg. 1 8-15 tmsk2 ?timer interrupt mask reg. 2 3-22 , 8-17 toc1?oc4 ?timer output compare reg. 8-12 tof - bit in tflg2 8-18 , 8-21 toi - bit in tmsk2 8-17 tpwsl - bit in pwen 8-32 u uart 5-1 v v-bit in ccr 11-5 vcoout 2-9 vcot - bit in pllcr 2-10 vdd ad, vss ad pins 2-2 vdd pin 2-2 vddl, vddr, vssl, vssr pins 2-2 vddsyn pin 2-6 vppe pin 2-12 vrh, vrl pins 2-13 vss pin 2-2 vstby pin 2-13 w wait mode 2-10 , 10-17 wake - bit in sccr1 5-8 wake2 - bit in s2cr1 5-16 wakeup, sci 5-4 watchdog - see cop wcol - bit in spsr 7-8 wen - bit in pllcr 2-10 wired_or 2-17 wired-or 2-12 , 2-16 , 3-2 , 4-12 wired-or interrupt 4-10 woieh ?wired-or interrupt enable reg. 4-10 woms - bit in sccr1 5-7 woms2 - bit in s2cr1 2-17 , 5-16 , 6-9 x x-bit in ccr 10-16 , 11-6 xfc pin 2-6 xirq 10-16 xirq /vppe 2-12 xppue - bits in ppar 4-11 xtal pin 2-3 z z-bit in ccr 11-5 tpg 258
1 2 3 4 5 6 7 8 9 10 11 a b c introduction pin descriptions operating modes and on-chip memory parallel input/output serial communications interface motorola interconnect bus (mi bus) serial peripheral interface timing system analog-to-digital converter resets and interrupts cpu core and instruction set electrical specifications (standard) mechanical data and ordering information development support tpg 259
1 2 3 4 5 6 7 8 9 10 11 a b c introduction pin descriptions operating modes and on-chip memory parallel input/output serial communications interface motorola interconnect bus (mi bus) serial peripheral interface timing system analog-to-digital converter resets and interrupts cpu core and instruction set electrical specifications (standard) mechanical data and ordering information development support tpg 260
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15
2 1 3 4 5 6 7 8 9 10 11 12 13 14 15 how to reach us: mfax : rmfax0@email.sps.mot.com ?touchtone (602) 244-6609 internet : http://www.mot.com/sps/ usa/europe : motorola literature distribution; p.o. box 5405; denver, colorado 80217. 303-675-2140 japan : nippon motorola ltd.; tatsumi-spd-jldc, toshikatsu otsuki, 6f seibu-butsuryu-center, 3-14-2 tatsumi koto-ku, tokyo 135, japan. 81-3-3521-8315 hong kong : motorola semiconductors h.k. ltd.; 8b tai ping industrial park, 51 ting kok road, tai po, n.t., hong kong. 852-26629298


▲Up To Search▲   

 
Price & Availability of MC68HC11PH8

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X